文档

Unity Engine

Unity Engine

Auto()

Creates a helper struct for the scoped using blocks.
阅读时间1 分钟最后更新于 1 个月前

Definition

public ProfilerMarker.AutoScope Auto()

Returns

Type

Description

AutoScopeIDisposable struct which calls ProfilerMarker.Begin and ProfilerMarker.End automatically.

Remarks

ProfilerMarker.Begin is called in the constructor and ProfilerMarker.End in the Dispose method.
Note: ProfilerMarker.Auto is thread safe and can be used in jobified code.

Examples

using Unity.Profiling;public class MySystemClass{ static ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker("MySystem.Simulate"); public void UpdateLogic() { using (s_SimulatePerfMarker.Auto()) { // ... } }}