Version: 2020.1
LanguageEnglish
  • C#

ProfilerMarker.End

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public void End();

Description

End profiling a piece of code marked with a custom name defined by this instance of ProfilerMarker.

Always use Begin to start a section of an instrumented code.
Code marked with Begin and End will show up in the Profiler hierarchy. Use Recorder to obtain per-frame timings in the Player.

Note: Both Begin and End are thread safe and can be used in jobified code.

using Unity.Profiling;

public class MySystemClass { static ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare");

public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); } }

End is conditionally compiled away using ConditionalAttribute. Thus it will have zero overhead, when it is deployed in non-Development Build.

See Also: ProfilerMarker.Begin, Recorder, ProfilerCPU.

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答