Connect unity profiler to Android real machine for debugging

Profiler can watch the performance consumption in editor mode, but after all, the computer configuration is high, which is different from the real mobile environment. It is recommended to use real machine test for optimization in actual development

Because the IOS configuration is generally higher than that of Android mobile phones, optimization on Android platform is generally not a big problem in IOS. The following describes how to connect profiler to Android real machine for debugging

A profiler monitors unity’s packets to run directly on the phone

1 Android device settings:

Mobile phone open developer mode and USB debugging

2 building settings

(1) switch to Android platform

(2) select internal for build system

(3) building setting check development build, Autoconnect profiler, script debugging. Click building and run. After the package is successful, the program will run

(4) add open scenes add the scene to be tested as the current scene

3 package:

Connect the Android device to the computer with USB cable, and click build & amp; Run. After packaging, click the required authorization information on the Android device to make the program run on the Android device

4 profiler monitoring:

(1) after packaging, unity will automatically open the profiler window. If the program on Android device is running but does not automatically open the profiler window, click window – > Profiler open manually

(2) in the profiler window, click editor, click Android player (ADB..), select monitor Android device, and select record to start monitoring

  

Second, profiler monitors other programs

① Mobile phone open developer mode and USB debugging

② Open the CMD command-line tool, CD to the directory of adb.exe in the SDK, and mine is in E::?Android?Android?SDK?Windows?Platform tools

Then type ADB forward tcp:34999 localabstract : unity package name, such as ADB forward tcp:34999 localabstract :Unity-com.company.product。

③ Window-> Profiler, select Android player( [email protected] : 34999), select record to start monitoring

If you can’t connect during the test

Make sure that the firewall doesn’t block the port we want to connect to

2 error: failed to connect to player IP: 127.0.0.1, port:34999 Solution: when packing, check enable internal profile in player setting

Similar Posts: