How to debug your Unity3D Android application in Visual Studio

Here’s how to debug an Unity3D Android application on a real device (not in Unity3D editor) over WIFI in Visual Studio. This recipe is written for Unity 2017.4 and Visual Studio 2017, maybe it works also in other versions.


1] Connect your Android phone to the same WIFI station as your development computer
2] Connect your Android phone with USB cable to your development computer

Step 1]  Connect to device with ADB

  • Get the IP number of your Android phone  with command ‘adb shell ip addr show wlan0’:
$ adb shell ip addr show wlan0
 24: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 3000
 link/ether 2c:fd:a1:8c:dc:f1 brd ff:ff:ff:ff:ff:ff
 inet brd scope global wlan0
 valid_lft forever preferred_lft forever
 inet6 fe80::2efd:a1ff:fe8c:dcf1/64 scope link
 valid_lft forever preferred_lft forever

IP adress in this case is:

  • Make a connection using adb connect

If connect fails take a look at

$ adb connect
connected to
  •  Disconnect phone from USB cable
  • Check WIFI connection with to device with:
$ adb devices
 List of devices attached device

Step 2] Prepare debug version of Unity3D app

In Unity3D, go to Android build settings and check ‘Development Build’ and ‘Script Debugging’: Build_Settings.png

Now deploy and run your application (control-b). It’s important to run the application because otherwise the AndroidPlayer debugger will not show up in the next dialog.

Step 3] Set Visual Studio breakpoint and debug

Now in Visual Studio open a script and put a breakpoint.

Go to Debug -> Attach Unity debugger and a dialog with two debuggers should appear (one for Unity3D editor, one for Android device):


Select the ‘AndroidPlayer (USB)’ item and Visual Studio goes in debug mode. Note: This step can take a while if then Unity project is big.

Now run the application on the device and the breakpoint should be hit 🙂


6 thoughts on “How to debug your Unity3D Android application in Visual Studio

  1. What to do if my Unity3D App repeatedly crashes ?

    Visual Studio doesnt seem to help with finding the location or cause of crash.

  2. I did everything and more ! And it just does’nt work !!! The device (Nexus 10) is not showing in the list and the adb is connected. Im using Visual studio 2019. I can communicate with the device from unity editor for debug log info or profiling etc … but i can’t trace in visual studio ….

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s