使用 性能分析器一个帮助您优化游戏的窗口。它显示了在游戏的各个区域花费了多少时间。例如,它可以报告渲染、动画或游戏逻辑中花费的时间百分比。 更多信息
在 词汇表 中查看 收集有关应用程序的性能数据。您可以在 Unity 编辑器中 在播放模式下收集性能数据。但是,要获取有关应用程序的最准确数据,您可以将性能分析器直接连接到网络上的 Android 设备。
54998
到 55511
。这些是 Unity 用于远程性能分析的端口。要启用远程性能分析,请按照以下步骤操作
打开性能分析器窗口后,它将使用来自应用程序的数据进行填充。如果编辑器未自动连接到设备,请在性能分析器窗口中选择目标选择下拉菜单,然后选择相应的设备以手动启动性能分析器连接。
您也可以将目标设备直接插入计算机,以避免网络或连接问题。
Android 设备支持通过 Android 调试桥 (adb) 进行性能分析。要使用 Android 调试桥 (adb) 进行性能分析,请按照以下步骤操作
AndroidProfiler(ADB@127.0.0.1:34999)
。下拉菜单中的条目仅在所选目标为 Android 时可见。当您选择 **构建并运行** 时,编辑器会自动为您的应用程序创建一个 adb 隧道。如果您想分析其他应用程序或重新启动 adb 服务器,可以手动配置此隧道。
要手动配置隧道
打开一个终端窗口或命令提示符。
输入以下内容
当编辑器到 Android 连接通过 USB 电缆建立时需要
adb forward tcp:34999 localabstract:Unity-{在此处插入捆绑标识符}
当 Android 到编辑器连接通过 USB 电缆建立时需要
adb reverse tcp:34998 tcp:34999
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.