public ProfilerMeasurement(SampleGroup[] sampleGroups) { if (sampleGroups == null) { m_Test = null; return; } if (sampleGroups.Length == 0) { m_Test = null; return; } var go = new GameObject("Recorder"); if (Application.isPlaying) { Object.DontDestroyOnLoad(go); } go.hideFlags = HideFlags.HideAndDontSave; m_Test = go.AddComponent <ProfilerMarkerMeasurement>(); m_Test.AddProfilerSampleGroup(sampleGroups); PerformanceTest.Disposables.Add(this); }