標籤:unity profiling 效能
Unity提供兩種方式讓Developer的Android裝置串連Profiler進行效能分析:
1、通過wifi,Android裝置和電腦處於同一個Wlan中。
2、通過USB ADB
一般情況我們的電腦都是網線,所以我們採用ADB的方式。相比與wifi,ADB也更及時的反應裝置效能。
官方的英文文檔如下:
http://docs.unity3d.com/Manual/Profiler.html
For ADB profiling, follow these steps: Attach your device to your Mac/PC via cable and make sure ADB recognizes the device (i.e. it shows in adb devices list). Check the “Development Build” checkbox in Unity’s build settings dialog, and hit “Build & Run”. When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler) Select the AndroidProfiler([email protected]:54999) from the Profiler Window Active Profiler drop down menu. Note: The Unity editor will automatically create an adb tunnel for your application when you press “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:Unityinsert bundle identifier hereNote: 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.
按照文檔的步驟,這裡我來翻譯一下:
首先我們先設定ADB:
開啟CMD命令列視窗,輸入以下命令:
adb forward tcp:54999 localabstract:Unity-com.thisisgame.gamedemo
然後 從Unity中Export Android 工程的時候一定要勾選 Development Build
然後在手機上開啟遊戲。
開啟Unity Profiler視窗選擇([email protected]:54999)
然後就能在Profiler進行效能分析了。
Android裝置串連Unity Profiler效能分析器