[Android] Connect Unity Profiler to Mobile Device

There is a good descrption about how to remote profiling on device on Unity Manual page (Link). However, sometimes it doesn’t work like that if you miss some parts or mix the procedure.  This is easy steps you can follow.

  • Build with option check ‘Development Build’ on Build Settings.
  • Install the app just built.
  • Check the cable connection between PC/Mac and the device.
  • Open any command console on PC/Mac
  • Check if the device is detected through adb command.
    • > adb devices
if any device is not attached, you should check if the device driver is installed properly.
  • Open adb tunnel between Unity Editor and the installed app
    • > adb forward tcp:34999 localabstract:Unity-{insert bundle identifier here}
    • if unity version is under Unity 5.x, then port number is 54999.
  • Start Unity editor. (Don’t start Unity editor before adb tunneling)
  • Open Profiler window ( Unity top menu: Window > Profiler )
  • Select the AndroidProfiler(ADB@127.0.0.1:34999) on Active Profiler dropdown menu
Profiler dropdown menu
  • You should see cpu, memory, and various graphs from there.

  • If not showing any graph, or if active profiler is not AndroidProfiler(ADB@127.0.0.1:34999), then follow below steps.
  • Stop/close Unity editor process completely. (RESTART STEP)
  • Restart adb server
    • > adb kill-server
    • > adb start-server
  • Open adb tunnel again.
    • > adb forward tcp:34999 localabstract:Unity-{insert bundle identifier here}
  • Start Unity editor.
  • Open Profiler window.
  • Select the AndroidProfiler(ADB@127.0.0.1:34999) on Active Profiler dropdown menu.
  • You should see various graphs now.
  • You might disconnect the tunnel if you unplug your device from PC/Mac. Then follow steps from “RESTART STEP” again.

  • If you are still not seeing any profiling results, then check firewall port settings.
    • (Windows) Control panels > System and security > Windows firewall > Advanced settings
      • Click Outbound Rules
      • Click New Rule… on Actions
      • Port
        • TCP / 54998-55511
      • Set any name such as UnityRemoteProfiling.
  • Then follow steps from “RESTART STEP” again.

Leave a Reply

Your email address will not be published. Required fields are marked *