Unity3d开发性能优化-性能分析工具Profiler使用

Unity3d 自带非常好用的性能分析工具:Profiler

以下为Android平台下Unity3d应用的Profiler的使用步骤:
1. 发布Untiy Android APK时,勾选“Development Build”和“AutoConnect Profiler”选项
这里写图片描述
2. 将Android设备采用adb的方式与PC相连
3. 开始运行应用后,点击Unity菜单栏-Window-Profiler,选择ActiveProfiler -
Unity5.5: ADB@127.0.0.1:54999
Unity5.6: ADB@127.0.0.1:34999
一定要保证防火墙中54998 to 55511(Untiy5.6:34999)的端口是打开状态,我一般所有端口都打开了。
4. 打开CMD,输入:
adb start-server
adb forward tcp:54999 localabstract:Unity-xxx.xxx.xxx (Untiy5.5)
(Unity5.6: adb forward tcp:34999 localabstract:Unity-xxx.xxx.xxx)
(xxx.xxx.xxx指的是Unity应用程序的Bundle Identifier,也就是APK的包名)

使用教程参考官方教程:
https://docs.unity3d.com/Manual/ProfilerWindow.html
Android

here are two methods to enable remote profiling on Android devices: WiFi or ADB.

For WiFi profiling, follow these steps:

  1. Make sure to disable Mobile Data on your Android device.
  2. Connect your Android device to your WiFi network.(The Profiler uses a local WiFi network to send profiling data from your device to the Unity Editor.)
  3. Attach your device to your Mac or PC via cable. Check the Development Build and Autoconnect Profiler checkboxes in Unity’s Build Settings dialog box, and click on Build & Run in the Unity Editor.
  4. When the app launches on the device, open the Profiler window in the Unity Editor (Menu: Window > Profiler).
  5. If the Unity Editor fails to autoconnect to the device, select the appropriate device from the Profiler window Active Profiler drop down menu.

Note: The Android device and host computer (running the Unity Editor) must both be on the same subnet for the device detection to work.

For ADB profiling, follow these steps:

  • Attach your device to your Mac or PC via cable and make sure ADB recognizes the device (i.e. it shows in adb devices list).
  • In the Unity Editor’s Build Settings dialog box (menu: File__>__Build
    Settings…), check the Development Build__checkboxcheck and select Build & Run__.
  • When the app launches on the device, open the Profiler window in the
    Unity Editor (Menu: Window > Profiler).
  • Select the AndroidProfiler(ADB@127.0.0.1:54999) from the Profiler
    Window Active Profiler drop down menu. Note: The Unity Editor
    automatically creates an adb tunnel for your application when you
    click on Build & Run. If you want to profile another application or
    you restart the adb server you have to setup this tunnel manually. To
    do this, open a Terminal window / CMD prompt and enter:

    adb forward tcp:54999 localabstract:Unity-{insert bundle identifier here}
    Note: The entry in the drop down menu is only visible when the selected target is Android.

    If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewall’s outbound rules - these are the ports used by Unity for remote profiling.

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值