public static bool enabled ;

描述

启用性能分析器。

Profiler.enableBinaryLog 一同启用后,Unity 玩家会将性能分析数据保存到 Profiler.logFile 文件中指定的文件中。玩家会自动将文件扩展名“.raw”分配给此日志文件。您可以在 Unity Editor 的 Profile 窗口中加载此文件,以便查看其中的数据。

如果缓冲区太小而无法输出性能分析器数据,则在调试日志会看到一条消息 "Skipping profile frame.Receiver can not keep up with the amount of data sent"。 使用 Profiler.maxUsedMemory 来增加缓冲区内存。

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

public class ExampleClass : MonoBehaviour { void Start() { Profiler.logFile = "mylog"; //Also supports passing "myLog.raw" Profiler.enableBinaryLog = true; Profiler.enabled = true;

// Optional, if more memory is needed for the buffer Profiler.maxUsedMemory = 256 * 1024 * 1024;

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