使用Profiler.BeginSample()定位函数消耗

在这里插入图片描述
我不加入Profiler.BeginSample的话,也是可以看到NewBehaviourScriptxxx的Update方法被调用的。
在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;

public class NewBehaviourScriptxxx : MonoBehaviour
{
    
    
    // Start is called before the first frame update
    void Start()
    {
    
    
        
    }

    // Update is called once per frame
    void Update()
    {
    
    
        Profiler.BeginSample("xxxxx");
        SayHello();
        Profiler.EndSample();
        SayHello2();
    }

    void SayHello()
    {
    
    

    }

    void SayHello2()
    {
    
    

    }
}

加了之后呢?
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

おすすめ

転載: blog.csdn.net/wodownload2/article/details/120222458