Version: 2023.1
언어: 한국어
public Profiling.Recorder GetRecorder ();

반환

Recorder Recorder object associated with the Sampler.

설명

Returns Recorder associated with the Sampler.

Each Sampler has only one recorder. Multiple calls to GetRecorder return references that control the same native Recorder object. If Sampler object is invalid, it returns invalid Recorder object as well.

using UnityEngine;
using UnityEngine.Profiling;

public class ExampleClass : MonoBehaviour { Recorder behaviourUpdateRecorder; void Start() { var sampler = Sampler.Get("BehaviourUpdate"); behaviourUpdateRecorder = sampler.GetRecorder(); if (behaviourUpdateRecorder.isValid) behaviourUpdateRecorder.enabled = true; }

void Update() { if (behaviourUpdateRecorder.isValid) Debug.Log("BehaviourUpdate time: " + behaviourUpdateRecorder.elapsedNanoseconds); } }

Note: At the moment Samplers are available only in the Editor and Development Players. Use Sampler.isValid to verify if Sampler can be used to create a valid Recorder.

See Also: Sampler.isValid, Recorder, Recorder.isValid.

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