name | 标记名称。 |
category | Profiler category. |
nameLen | Marker name length. |
flags | The marker flags. |
为代码检测构造一个新的性能标记。
使用 ProfilerMarker 为 Profiler 和 Recorder 标记一段代码。
using Unity.Profiling;
public class MySystemClass { static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate");
public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End();
using (s_SimulatePerfMarker.Auto()) { // ... } } }