# Debugging and diagnostics

> Debug, diagnose, and fix problems in your code.

Unity supports a range of tools for debugging and diagnosing issues in your project code.

| **Topic**                                                                                                                       | **Description**                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **[Adding diagnostics to C# code](/engine/6000.7/manual/scripting/debugging-and-diagnostics/managed-code-variants.md)**         | Use the managed code variant setting to include additional diagnostics, debug symbols, or instrumentation in your compiled C# code to help with debugging or profiling a built Player. |
| **[Debug C# code in Unity](/engine/6000.7/manual/scripting/debugging-and-diagnostics/managed-code-debugging.md)**               | Track down bugs in your scripts by attaching external debuggers and stepping through your project code as it executes.                                                                 |
| **[Troubleshooting debugging](/engine/6000.7/manual/scripting/debugging-and-diagnostics/managed-debugging-troubleshooting.md)** | Troubleshoot common problems with attaching to and debugging the Unity Editor or Player.                                                                                               |
| **[The Debug class](/engine/6000.7/manual/scripting/debugging-and-diagnostics/class-debug.md)**                                 | Use the [Debug](/engine/6000.7/script-reference/unityengine/debug.md) class in your project code to write messages and errors to the Console window.                                   |
| **[Log files reference](/engine/6000.7/manual/scripting/debugging-and-diagnostics/log-files.md)**                               | Locate Unity's log files which record messages, warnings, and errors that can help you understand the source of problems in your application.                                          |
| [Stack trace logging](/engine/6000.7/manual/scripting/debugging-and-diagnostics/stack-trace.md)                                 | Configure the level of stack trace information shown in Unity's log files and console to help track down problems in your scripts.                                                     |
| [Roslyn analyzers and source generators](/engine/6000.7/manual/scripting/debugging-and-diagnostics/roslyn-analyzers.md)         | Use analyzers to inspect your code for style, quality, and other issues.                                                                                                               |
| [Safe Mode](/engine/6000.7/manual/scripting/debugging-and-diagnostics/safe-mode.md)                                             | Understand Unity's Safe Mode, a mode that the Unity Editor enters if there are compilation errors in your project.                                                                     |

## Additional resources

* [Debugging with Microsoft Visual Studio 2022](https://unity.com/how-to/debugging-with-microsoft-visual-studio-2022)
* [Debug API reference](/engine/6000.7/script-reference/unityengine/debug.md)
