Unity debugging for android devices

chanban picture chanban · Jan 16, 2017 · Viewed 8.4k times · Source

I'm having a hard time getting breakpoint debugging working for unity with and android device. I've tried with both visual studio code and monodevelop.

In android:

I have successfully done all the steps outlined here for getting android connected over wifi in tcpip mode: https://docs.unity3d.com/Manual/AttachingMonoDevelopDebuggerToAnAndroidDevice.html enter image description here

In unity

In build settings I have "development build" and "script debugging" checked. When I build and run, it programs my device just fine over wifi. Android build settings

For monodevelop

I try debugging with "attach to process" but it only finds the Unity Editor. enter image description here Lots of people have the same problem:https://forum.unity3d.com/threads/attaching-monodevelop-debugger-to-an-android-device.245814/ Down at the bottom, people are figuring out that multicast settings were the issue. I have a linksys router, and I've ensured that security->filter multicast is unchecked. Is there anything else I have to do here to get multicast to work?

Since monodevelop wasn't working, I tried with vscode

For VS code

I added the plugin to an empty project as described here: https://code.visualstudio.com/Docs/runtimes/unity

When I try debugging with vscode I get the error "Could not find target name 'Android Player'. Is it running?" enter image description here

I also wanted to see which processes I could select but when I try running "Unity Attach Debugger" from the command palette, I get this error: "command 'attach.attachToDebugger' not found" enter image description here

Any help would be much appreciated!

Answer

brookinc picture brookinc · Jun 14, 2017

For what it's worth, I've encountered the Could not find target name 'Android Player'. Is it running? message in Visual Studio Code when my laptop and the Android device I'm trying to debug were (accidentally) not connected to the same wifi network.

Connecting them to the same network got things working again. So that's an easy thing to check. :)