启用记录。
启用后,Recorder 将收集数据,无论 Profiler 是否已启用。
注意
设定为false 以便立即将测量结果用于同步测试方案。
using UnityEngine; using UnityEngine.Profiling;
public class Example { public static void TimeSynchronousMethodWithMarkers() { var recorder = Recorder.Get("MyMarker"); recorder.enabled = true; // Starts measurements
// Call method which uses MyMarker // MyMethod();
recorder.enabled = false; // Stops measurements and makes data available immediately Debug.Log("MyMarker total time, ns: " + recorder.elapsedNanoseconds); } }