This version of Unity is unsupported.

Recorder.enabled

public bool enabled;

Description

Enables recording.

When enabled Recorder collects data regardless of Profiler being enabled or not.

Note:
Set to false to make measurements available immediately for synchronous testing scenarious.

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); } }