Profiler.enableBinaryLog

切换到手册
public static bool enableBinaryLog ;

描述

启用将性能分析数据记录到文件中的功能。

When enabled, the Unity player saves profiling data to the file specified in the Profiler.logFile file. The player automatically assigns the file extension, “.raw” to this log file. You can load this file in the Unity Editor Profile window to view the data.

您还必须将 Profiler.enabled 设置为 true

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; } }