Unity 6.3
0 онлайн 78 гостей 3 в системе
Вход

ProfilerRecorderOptions.SumAllSamplesInFrame

Описание

Используется для суммирования всех выборок в кадре и сбора их как одной выборки на кадр.

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

Дополнительные ресурсы: ,ProfilerRecorderSample,.