ドキュメント

Unity Engine

Download Unity

Unity Engine

Code reloading issues

Understand how code reloading can affect your project.
読み終わるまでの所要時間 1 分最終更新 3日前

Project Auditor uses a Roslyn analyzer to detect code issues that can cause unexpected or nondeterministic behavior if code reload on entering Play mode is disabled in your project, as it is by default. Code 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 keep code reload off.

Code reload overview

For an overview of what code reload is and the effects of keeping it off, refer to Enter Play mode without code reload.
The Roslyn analyzer searches the project's code for types with static fields that would keep their value between different Play mode runs unless reset.
Project Auditor raises warning diagnostics if a type has any static fields, automatic properties, or events that are not decorated with either the
[AutoStaticsCleanup]
or the
[NoAutoStaticsCleanup]
attribute. The analyzer emits warnings with the
UAL
prefix.

Display code reload issues

Project Auditor displays code reload issues in the Code Issues view, alongside other code issues. These issues affect Editor iteration time.

Resolve code reload issues

For information on the exact warning codes generated by the analyzer and the appropriate resolution for each of them, refer to Automatic reset of static state.

Additional resources