Version: 2020.3

Recorder.sampleBlockCount

切换到手册
public int sampleBlockCount ;

描述

在前一帧中调用 Begin/End 对的次数。(只读)

计数器表示前一帧中已完成或正在运行的性能分析块的数量。

using UnityEngine;
using UnityEngine.Profiling;

public class ExampleClass : MonoBehaviour { Recorder materialSetPass; void Start() { materialSetPass = Recorder.Get("Material.SetPassFast"); materialSetPass.enabled = true; }

void Update() { if (materialSetPass.isValid) Debug.Log("Material SetPass count: " + materialSetPass.sampleBlockCount); } }