path | 内存快照文件的目标路径。 |
finishCallback | 内存快照完成捕获数据的过程后立即触发的事件。 |
captureFlags | 用于定义内存快照内容的标志掩码。 |
screenshotCallback | 可指定在快照完成后获取抓屏图片的事件。 |
触发内存快照捕获。
使用提供的参数请求内存快照捕获。不会收集与捕获标志对应的所有字段。这取决于用于捕获快照的目标版本。系统中有两种不同的数据收集行为:
* 直接从播放器或编辑器中调用时,该过程在主机 device.Note 上同步创建内存快照文件。注意:这要求未连接性能分析目标。如果在 MemoryProfiler.CreateMetaData 中注册了至少一个收集回退,则会进行元数据收集。在该过程结束时将触发 MemoryProfiler.SnapshotFinished。
* 在编辑器中调用并且已连接到性能分析目标时,该过程在主机设备上异步创建内存快照文件,并向远程目标发送捕获请求。然后,目标设备使用注册到 MemoryProfiler.CreateMetaData 的回调来收集元数据。必须在性能分析目标的本地程序集中定义这些回调,并在发送捕获事件之前在运行时注册它们。所有捕获的数据都从远程目标流式传输到编辑器。完成捕获过程时,在编辑器内触发快照完成回调。如果在调用过程中提供了屏幕快照回调,则在当前帧结束时调用该回调。
注意:
* 仅在独立平台播放器中或运行模式下调用屏幕快照回调。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.