using Unity.Profiling; using UnityEngine; public sealed class AllocationProbe : MonoBehaviour { private static readonly ProfilerMarker WorkMarker = new ProfilerMarker("SharpRune.BufferWork"); [SerializeField] private bool allocateEveryFrame; [SerializeField] private int lastSample; private int[] reusable; private void Awake() { reusable = new int[1024]; } private void Update() { using (WorkMarker.Auto()) { int[] buffer = allocateEveryFrame ? new int[1024] : reusable; buffer[0] = Time.frameCount; lastSample = buffer[0]; } } }