Phase 4 updates

Phase 4 · Slice 8 ·

Assembly definitions

  • A Unity project compiles into the assemblies Unity would make:
    • one per .asmdef, under Assets or in an embedded package, holding its folder's scripts (and .asmref folders), minus subfolders with their own;
    • Assembly-CSharp-firstpass for Plugins and Standard Assets;
    • Assembly-CSharp for the rest. Firstpass and Assembly-CSharp reference every auto-referenced asmdef. References may name an asmdef or give its GUID; references outside the project (Unity packages) are reported. Editor-only, test and unmet-defineConstraints assemblies are left out, as in a player build. A reference cycle is a compile error.
  • All assemblies build in one dotnet build of a generated solution, and MSBuild's incremental build skips unchanged ones.
  • Hot reload works per assembly. A changed assembly reloads together with every assembly that references it, because their code is bound to the old one. Types may move between assemblies, and assemblies may appear or disappear.
  • ScriptableObjects hot reload too. Live instances are tracked weakly. Each one gets OnDisable, a new instance with its fields copied takes its place (references in scripts, other assets and the asset cache are updated), and then OnEnable runs.
  • An MCP e2e test covers a Coin Dash copy with asmdefs: a GUID reference, an asmref sharing internals, firstpass, an editor-only assembly and a broken test assembly. It edits a core assembly and checks that its dependents reload with their state and with ScriptableObjects swapped. It also checks that a cycle is a compile error.
  • Next: MCP resources and the exec tool, .csproj generation for IDEs, precompiled plugin DLLs.