I am unable to attach a VS code debugger to a standalone android app.
I can attach the Visual Studio 2022 debugger via USB to a Unity app running on Android using Debug->Attach Unity Debugger, then selecting the android app from the list. However, such functionality does not seem to be available in Visual Studio Code, or am I missing something? I am only able to debug the app running in the Unity editor, but not a standalone app.
2024 - Tested with Visual Studio Code v1.95.3 and Unity v2022.3.49f1
First, enable developer options on the device side. On Unity side, "Check Development Build", "Script Debugging" and "Wait For Managed Debugger" then Build and Run. When the application starts, it will show which port it is running on.
Add a new configuration to launch.json file in Visual Studio.
{
"name": "Attach to Unity Device",
"type": "vstuc",
"request": "attach",
"endPoint": "<WLAN IP>:<PORT>"
}
Select the new configuration and attach the debugger.
Now you can debug with breakpoints, watch etc. without editor. However, when the script changes, you need to rebuild the app and deploy it to the device.
Full sample is in here (9:47): https://www.youtube.com/watch?v=OVWN7RdNk4M