简体   繁体   中英

Unity debugging for android devices

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 在此处输入图片说明

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 构建设置

For monodevelop

I try debugging with "attach to process" but it only finds the Unity Editor. 在此处输入图片说明 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?" 在此处输入图片说明

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" 在此处输入图片说明

Any help would be much appreciated!

For what it's worth, I've encountered the Could not find target name 'Android Player'. Is it running? 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. :)

I also got the problem today.

Your front steps are correct. Problem is "Attach to Process".

After app run on android device, close unity but keep monodevelop, then click the run button(or menu Run | Attach to Process) of monodevelop. Now u can see device list in the dialog.

It works for me. I found the solution from the thread u mentioned

#15 manuelpeirone's answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM