Cause and mechanism
An asmdef defines which C# files compile together and which assemblies they reference. Distinguish a long single compile, reference errors, and repeatedly restarted compilation. Cyclic references or Editor dependencies mainly call for reference checks; repeated starts also require checking scripts that continually regenerate or modify files.
Check and correct the setup
- Check the first Console error and Editor.log for repeated import/generation/compilation.
First error, references and target environment - Make assembly references acyclic and restrict editor assemblies to Editor.
First error, references and target environment - Inspect generators/postprocessors for repeated writes; organize dependencies before splitting to improve compilation time.
First error, references and target environment
Limits and verification
More assemblies do not fix circular dependencies automatically. Check a restart and player build for stable compilation.
Unity: assembly references and circular dependencies
A focused diagnostic setup
Trace Editor.log from one save, distinguishing one long compilation from repeated starts around generated files. Read the first reference error.
Test in this order
- Map assembly references, Editor boundaries and cycles.
First error, references and target environment - Pause generation and inspect repeatedly modified source/configuration files.
First error, references and target environment - Skip identical writes and verify convergence after one save.
First error, references and target environment
Interpret the result
Dependency cycles and repeated file writes require different fixes. More asmdefs alone can obscure the issue. Recheck after restart and in a Player build.