path | 内存快照文件的目标路径。 |
finishCallback | 内存快照完成捕获数据的过程后立即触发的事件。 |
captureFlags | 用于定义内存快照内容的标志掩码。 |
触发内存快照捕获。
使用提供的参数请求内存快照捕获。请注意,根据用于捕获快照的目标构建,不会收集与捕获标志对应的所有字段。系统内部存在两种不同的数据收集行为:
* 直接从播放器或编辑器中调用时(未连接到性能分析目标)- 该过程是同步的,会在主机设备上创建内存快照文件。如果在 MemoryProfiler.CreateMetaData 中注册了至少一个收集回调,则会进行元数据收集。在该过程结束时将触发 MemoryProfiler.SnapshotFinished。
* 在连接到性能分析目标的编辑器的上下文中调用时 - 该过程是异步的,会在主机设备上创建内存快照文件并向远程目标发送捕获请求。然后,目标设备使用注册到 MemoryProfiler.CreateMetaData 的回调来收集元数据。请注意,回调必须在性能分析目标的本地程序集中定义,并在发送捕获事件之前在运行时注册。所有捕获的数据都将从远程目标流式传输到编辑器。完成捕获过程时将在编辑器内触发 MemoryProfiler.SnapshotFinished。
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.