Capture had two leak vectors:

  1. SequenceCaptureWindow.EnsureDefines() added DEMO_BUILD + CLAUDE_DEMO_BUILD to the active build target’s scripting defines but never removed them. Once you ran Capture once, every editor play after compiled with demo code in. Audio listener got hijacked by Unity Recorder hooks loaded via the demo-only assemblies’ MovieRecorderSettings audio capture.

  2. The single-shot EP_ACTIVE flag could get stuck true if bootstrap didn’t run (compile race between EnsureDefines and Play start, exception during play, manual Stop Play before bootstrap fired). Next play read EP_ACTIVE=true -> ClaudeDemo mode -> audio broken.

Fix:

  • Add SequenceCaptureLifecycle ([InitializeOnLoad]) that hooks EditorApplication.playModeStateChanged. On every EnteredEditMode: a) Force-clear EP_ACTIVE (defensive) b) Strip CLAUDE_DEMO_BUILD + DEMO_BUILD if we added them this session (tracked via new EP_DEFINES_ADDED flag set in EnsureDefines)
  • Preserve PLAYER_DEMO_BUILD: only strip DEMO_BUILD if the build target isn’t the player-demo target (PLAYER_DEMO_BUILD as marker).
  • DemoBootstrap.ResetMode at SubsystemRegistration as belt-and-suspenders: forces Mode=None at the start of every play, before Init runs. Protects against “Enter Play Mode Options -> Reload Domain disabled” preserving stale static state across plays.

After: capture is transactional. Defines + active flag set on Capture click, removed on Play exit, regardless of how the play ended. Normal play sessions are guaranteed clean.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]


Commit f20bff5 by astafford8488.