本文档主要是对Unity官方教程的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于 Unity2017.3版本
参考链接: https://docs.unity3d.com/Manual/BestPracticeUnderstandingPerformanceInUnity2.html
Memory
内存
Memory consumption is a critical performance indicator, and is especially important on platforms with limited memory resources, such as low-end mobile devices.
内存消耗是一个关键的性能指标,在内存资源有限的平台上尤其重要,比如低端移动设备。
Profiling memory consumption
分析内存消耗
Diagnosing memory issues in Unity is best performed with an open-source memory visualization tool available from Unity’s Bitbucket. Integration of this tool is as simple as downloading the linked repository and dropping the included Editor folder into a project.
在Unity的Bitbucket中用一个开源的内存可视化工具,是最好的诊断Unity中的内存问题。这个工具的集成只需要下载链接的存储库并放在项目的Editor 文件夹下。
The tool can be used with any version of Unity from 5.3 onwards. It can capture a wealth of information on native- and managed-code memory consumption when attached to an application built with IL2CPP.
该工具可用于Unity 5.3之后的版本。当绑定用IL2CPP生成的应用,它可以捕获关于本地和托管代码内存消耗的大量信息。
To use the tool, simply build a project with an IL2CPP scripting backend and deploy it to the appropriate device. Attach Unity’s regular in-editor CPU profiler, then open the Memory Profiler window (menu: Window > MemoryProfilerWindow) and selet Take Snapshot.
要使用这个工具,只需要用IL2CPP脚本后端编译一个项目,并将其部署到适当的设备上。附上Unity的常规编辑器内置的CPU profil