Learn how to set up Visual Studio or WinDbg to debug your application or the Unity Editor as it runs. This type of debugging is called live debugging.
Live debugging is an effective way to identify and resolve issues as they occur during application runtime.
If you prefer to use crash dump files to debug your application, refer to Set up forensic debugging for Unity.
If you plan to debug unmanaged code (code written in low-level languages such as C, C++, or Assembly), you need to configure your debugger to resolve Unity symbols. For instructions, refer to Configure your debugging tool to debug Unity in Windows.
Follow these steps to enable your debugger to debug your application or the Editor while it runs.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
“Auto”=“1”
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug]
“Auto”=“1”
As a result, your registry is now ready to accommodate automatic exception debugging.
You can use Visual Studio or WinDbg to debug processes within the Unity Editor itself, rather than your game or application. This is useful if you want to investigate when the Editor behaves unexpectedly.
Follow these instructions to attach a debugger to the Editor on launch:
cmd
and press Enter. This opens the command prompt window and uses your directory as the working directory. Unity.exe -dbgbreak
This prompt launches Unity and suggests a debugger to attach to the session.