C# Code Analysis section of Settings > Unity controls the Agent’s semantic C# capabilities. With it on, find-references and go-to-definition return compiler-grade results instead of text-search approximations.
C# code analysis switch
Semantic C# analysis backed by a Roslyn language server: components download on demand, and the server loads the Unity-generated solution. Allcode_* tools require this switch to be on.
The live status shows next to the switch: Preparing components, Downloading, Generating project files via Unity, Starting analysis server, Loading projects, then Code analysis ready, with the error message shown on failure. If results look wrong or the project structure changed heavily, click Restart to restart the analysis server and reload projects. The C# code analysis status indicator above the session composer offers the same view and restart.
How it works
In a Unity C# codebase, identical method and field names are everywhere; text search cannot tellPlayer.Reset() from Enemy.Reset(). A language service actually compiles the solution and understands each symbol’s type and owner, so the Agent gets semantically exact reference lists and signatures, and compiler diagnostics come back right after an edit, cutting the errors that come from guessing APIs by memory. The trade-off is a first-run component download and some loading time on large projects.
Roslyn tools
Per-tool switches; a disabled tool is removed from the Agent’s toolset entirely. When the main switch is off, none of these are available to the Agent regardless of their switches:code_symbol_search: search C# symbols (classes, methods, fields) across the workspace.code_goto_definition: resolve a symbol to its declaration, including other assemblies and packages.code_find_references: semantically exact references to a symbol across the workspace.edit/write diagnostics: after the Agent changes a Unity C# file, capped file-level errors, warnings, and project string-reference checks return automatically, closing the edit-then-verify loop.code_diagnostics: compiler and analyzer errors and warnings without compiling in Unity; file scope also validates tag, layer, scene, Resources, and Input string literals against the project settings. Both scopes also check that the types recorded by[SerializeReference]instances in assets still exist in code, catching renames or asmdef moves without[MovedFrom]that would silently drop data.code_hover: the exact signature, type, and docs of a symbol (IDE hover), so the Agent stops guessing APIs.Unity analyzers (UNT*): injects Microsoft.Unity.Analyzers, adding Unity-specific diagnostics tocode_diagnosticsand suppressing generic C# hints that mislead on Unity code. Toggling restarts the analysis server.
Asset-side tools
These bridge C# symbols to Unity asset data and project settings, and work without the Roslyn server:unity_code_usages: where a script or member is used inside scenes, prefabs, and assets: attach points, UnityEvent bindings, serialized fields, AnimationEvents,[SerializeReference]instances of the types the file declares (including subclasses, interface implementations, and instance types set on prefab instances, variants, and nested prefabs), and plain[Serializable]class/struct values held by serialized fields (arrays, lists, generics, and nested types included) together with their prefab overrides. Code-side find-references cannot see these usage sites, so have the Agent check here before deleting or renaming a script to avoid breaking scene bindings. This tool relies on the asset database. See Assets.
Connection and Embedding, Hot Reload & Compile, Testing, and more) are covered in Execute and compile and Hot reload.