Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SumAllSamplesInFrame

Use to sum all samples within a frame and collect those as one sample per frame.
Read time 1 minuteLast updated 4 days ago

Definition

SumAllSamplesInFrame = 16

Remarks

using System;using Unity.Profiling;using UnityEngine;public class CollectGCAllocCountExample2{ static void PrintGCAllocCount(Action a) { using (var gcAllocRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "GC.Alloc", 1, ProfilerRecorderOptions.SumAllSamplesInFrame | ProfilerRecorderOptions.CollectOnlyOnCurrentThread)) { a.Invoke(); gcAllocRecorder.Stop(); var count = gcAllocRecorder.Count == 0 ? 0 : gcAllocRecorder.GetSample(0).Count; Debug.Log("GC allocs count: " + count); } }}
Additional Resources: ProfilerRecorderSample.