Version: 2018.3 (switch to 2019.1)
LanguageEnglish
  • C#

AutoScope

struct in Unity.Profiling

/

Implemented in:UnityEngine.CoreModule

Description

Helper IDisposable struct for use with ProfilerMarker.Auto.

Use ProfilerMarker.Auto to enclose a piece of code you want to profile in using statement. Constructor of AutoScope calls ProfilerMarker.Begin and Dispose method - ProfilerMarker.Begin.

using Unity.Profiling;

public class MySystemClass { ProfilerMarker simulatePerfMarker = new ProfilerMarker("MySystem.Simulate");

public void UpdateLogic() { using (simulatePerfMarker.Auto()) { // ... } } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答