The Domain Reload view displays the results of a Roslyn analyzer that detects code issues that result in unexpected or non-deterministic behavior if domain reload is disabled in your project. Domain reloading can impact project iteration times (in particular, the time it takes to enter and exit Play mode), so it’s best practice to fix all the issues, and then disable domain reload.
For an overview of what domain reload is and the effects of disabling it, refer to the Unity user manual documentation on Code and scene reload on entering Play mode.
Project Auditor searches for the declaration of any static variables or events in a project. If it finds any, it then checks for the presence of a method with the [RuntimeInitializeOnLoadMethod] attribute. If such a method exists, its contents are analyzed to determine if the static variable or event is assigned to within its scope.
Project Auditor raises warning diagnostics if any of the following criteria are met:
[RuntimeInitializeOnLoadMethod] attribute exists.Initialize method.Initialize method.To display issues in the Domain Reload view, you need to enable the Use Roslyn Analyzers setting in the Preferences window. The use of Roslyn analyzers can cause Project Auditor’s analysis to take longer, so it’s disabled by default.
To allow Project Auditor to use Roslyn analyzers:
To resolve the issues reported in a C# script, you must do the following:
[RuntimeInitializeOnLoadMethod] attribute.