Version: 2018.4

CustomSampler

class in UnityEngine.Profiling

/

継承:Profiling.Sampler

マニュアルに切り替える

説明

Custom CPU Profiler label used for profiling arbitrary code blocks.

Use CustomSampler to measure execution time of script code blocks. Produced information is displayed in the CPU Profiler and can be captured with Recorder.
Using CustomSampler is more efficient than using Profiler.BeginSample to profile your code. This is because CustomSamplers that have been created in advance have very low Begin call overhead compared to Profiler.BeginSample.

using UnityEngine;
using UnityEngine.Profiling;

public class ExampleClass : MonoBehaviour { CustomSampler sampler; void Start() { sampler = CustomSampler.Create("MyCustomSampler"); }

void Update() { sampler.Begin(); // do something that takes a lot of time sampler.End(); } }

CustomSampler.Begin is conditionally compiled away using ConditionalAttribute. Thus it will have zero overhead, when it is deployed in non-Development Build.

See Also: Sampler, CustomSampler.Create, CustomSampler.Begin.

Public 関数

BeginBegin profiling a piece of code with a custom label defined by this instance of CustomSampler.
Endカスタムラベルの付いたコードの一部のプロファイリングを終了します

Static 関数

CreateCreates a new CustomSampler for profiling parts of your code.

継承メンバー

変数

isValidReturns true if Sampler is valid. (Read Only)
nameSampler name. (Read Only)

Public 関数

GetRecorderReturns Recorder associated with the Sampler.

Static 関数

GetReturns Sampler object for the specific CPU Profiler label.
GetNamesReturns number and names of all registered Profiler labels.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961