Dispose()
Releases unmanaged instance of the ProfilerRecorder.
Read time 1 minuteLast updated 11 days ago
Definition
- Type: Method
- Namespace: Unity.Profiling
- Assembly: UnityEngine.CoreModule
public void Dispose()
Remarks
When you no longer need to use the ProfilerRecorder always use this method to safely release the instance of it.
Examples
using Unity.Profiling;using UnityEngine;public class ExampleScript : MonoBehaviour{ ProfilerRecorder systemMemoryRecorder; ProfilerRecorder gcMemoryRecorder; ProfilerRecorder mainThreadTimeRecorder; void OnEnable() { systemMemoryRecorder = new ProfilerRecorder(ProfilerCategory.Memory, "System Used Memory", 1, ProfilerRecorderOptions.Default | ProfilerRecorderOptions.StartImmediately); gcMemoryRecorder = new ProfilerRecorder(ProfilerCategory.Memory, "GC Reserved Memory", 1, ProfilerRecorderOptions.Default | ProfilerRecorderOptions.StartImmediately); mainThreadTimeRecorder = new ProfilerRecorder(ProfilerCategory.Internal, "Main Thread", 15); mainThreadTimeRecorder.Start(); } void OnDisable() { systemMemoryRecorder.Dispose(); gcMemoryRecorder.Dispose(); mainThreadTimeRecorder.Dispose(); }}