Unity Debugging via Visual Studio
This guide only covers Unity C# script debugging. For C/C++ debugging, i.e. debugging custom or third party libraries, see Unity Native Debugging via Android Studio.
Build Settings
- Close Visual Studio if its open.
- In Unity, open the build settings window.
- Select the Development Build, Script Debugging and Wait for Managed Debugger options.
- Build the application and launch it on your device or select Build And Run.
- When the app is launched, it will wait for the managed debugger (Visual Studio) to connect before proceeding. Note: once the managed debugger from Visual Studio is connected, press either the Volume Up or Volume Down button on the compute pack to trigger the application to continue to load for debugging.
Debugging your Application
- In your Unity project, right-click on the Asset folder and select Open C# project, to open your project in Visual Studio.
- From Visual Studio select Debug > Attach to Unity Debugger from the top menu.
- Pick your device from the Select Unity Instance window, then press OK.
- If your device is connected via USB then it will appear in the list of drop-downs projects to attach to.
- If your device has WiFi, click on Input IP and enter the IP address of your device on the default port (56000).