Version: 2023.2
言語: 日本語
public void Begin ();
public void Begin (Object contextUnityObject);

パラメーター

contextUnityObject Object associated with the operation.

説明

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

Always use End to close a started 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(); } }

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

Additional resources: ProfilerMarker.End, Recorder, ProfilerCPU.