Connect Android devices to Unity Profiler Performance Analyzer
Unity provides two methods for developers to connect Android devices to Profiler for performance analysis:
1. The Android device and computer are in the same Wlan through wifi.
2. USB ADB
Generally, our computer is a network cable, so we use ADB. ADB is more responsive to device performance than wifi.
The official English documents are as follows:
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(ADB@127.0.0.1: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.
Follow the steps in this document to translate them here:
First, set ADB:
Open the CMD command line window and enter the following command:
adb forward tcp:54999 localabstract:Unity-com.thisisgame.gamedemo
Then, check the Development Build check when you use the Export Android project in Unity.
Then open the game on your phone.
Open the Unity Profiler window and select (ADB@127.0.0.1: 54999)
Then we can analyze the performance in Profiler.