Version: Unity 6 (6000.0)
Language : English
Stack trace logging
Create and use a source generator

Roslyn analyzers and source generators

Use Roslyn analyzers, source generators and ruleset files in Unity projects to inspect your code for style, quality, and other issues.

You can use existing analyzer libraries to inspect your code, and write your own analyzers to promote the best practices or conventions within your organization.

Note: Roslyn analyzers are only compatible with the IDEs that Unity publicly supports, which are Visual Studio and JetBrains Rider.

For more information about how to write and use Roslyn analyzers, refer to Microsoft’s Analyzer Configuration and Get started with Roslyn analyzers documentation.

Topic Description
Create and use a source generator Create a simple source generator and configure the Unity Editor to use it for your Unity project code.
Install and use an existing analyzer or source generator Download an existing code analyzer or source generator and configure the Unity Editor to use it for your Unity project code.
Create rule set files Create rule sets to customize the standards your code analysis tools enforce.
Code analyzer scope and diagnostics Control which parts of your code are subject to code analysis and get insights into how long analysis is taking.

Additional resources

Stack trace logging
Create and use a source generator