Version: 2022.2
public static void TakeSnapshot (string path, Action<string,bool> finishCallback, Unity.Profiling.Memory.CaptureFlags captureFlags);
public static void TakeSnapshot (string path, Action<string,bool> finishCallback, Action<string,bool,DebugScreenCapture> screenshotCallback, Unity.Profiling.Memory.CaptureFlags captureFlags);

参数

path 内存快照文件的目标路径。
finishCallback 内存快照完成捕获数据的过程后立即触发的事件。
captureFlags 用于定义内存快照内容的标志掩码。
screenshotCallback Event that you can specify to retrieve a screenshot after the snapshot has finished.

描述

触发内存快照捕获。

使用提供的参数请求内存快照捕获。不会收集与捕获标志对应的所有字段。这取决于用于捕获快照的目标版本。系统中有两种不同的数据收集行为:

* When you call this directly from the Player or in the Editor, the process synchronously creates the memory snapshot file on the host device.Note: This requires that there's no profiling target connected. Metadata collection happens if at least one collection fallback was registered to MemoryProfiler.CreatingMetadata. At the end of the process, MemoryProfiler.SnapshotFinished is triggered.

* When you call this in an Editor, and you have connected to a profiling target, the process asynchronously creates the memory snapshot file on the host device and sends the capture request to the remote target. The target device then collects meta data using the callbacks registered to MemoryProfiler.CreatingMetadata. You must define the callbacks in the profiling target's local assemblies and register them at run time before you send the capture event. All captured data is streamed to the Editor from the remote target. When the capture process is complete, the snapshot finished callback is triggered inside the Editor. If a screenshot callback was provided during the call, this is called at the end of the current frame.

注意: * 仅在独立平台播放器中或运行模式下调用屏幕快照回调。

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