Phase 4 updates

Phase 4 · Slice 3 ·

C# hot reload

  • Script assemblies (--scripts DLLs, a Unity project's Assembly-CSharp) load from bytes into collectible load contexts that share the engine assemblies; a reload loads the new build into a fresh context and unloads the old one.
  • Live instances are swapped in place (same native handle, instance ID, component slot): all old ones get OnDisable, then the new ones OnEnable; Awake/Start don't rerun, a Start still owed runs. Fields carry over by name, values of recompiled serializable types converted member by member; references to replaced instances are repointed in every script. Coroutines stop, statics reset, as in Unity.
  • The player watches sources (a project's Assets/*.cs, or the DLL) and builds off the main thread, swapping between frames; compile errors keep the old code. MCP has scripts_reload.
  • Scripts with the same name in two assemblies resolve to the right one: Unity 6's Assembly::Type identifier on import, Type, Assembly in scenes when ambiguous.
  • An e2e test edits Coin Dash's player script mid-game: the new code runs with the player's private state, and a broken edit leaves the game running.
  • Next: saving back to .unity, FBX meshes and sub-assets by file ID, ScriptableObjects, .asmdef assemblies, the agent review panel.