public int CopyTo (ProfilerRecorderSample* dest, int destSize, bool reset);

Parameters

destPointer to the destination samples array.
destSizeDestination samples array size.
resetReset ProfilerRecorder.

Returns

int Returns the count of the copied elements.

Description

Copies collected samples to the destination array.

using Unity.Profiling;

public class ExampleScript { static double GetRecorderFrameAverage(ProfilerRecorder recorder) { var samplesCount = recorder.Capacity; if (samplesCount == 0) return 0;

double r = 0; unsafe { var samples = stackalloc ProfilerRecorderSample[samplesCount]; recorder.CopyTo(samples, samplesCount); for (var i = 0; i < samplesCount; ++i) r += samples[i].Value; r /= samplesCount; }

return r; } }

public void CopyTo (List<ProfilerRecorderSample> outSamples, bool reset);

Parameters

outSamplesDestination list.
resetReset ProfilerRecorder.

Description

Copies all collected samples to the destination list.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961