@@ -26,6 +26,7 @@ public class EditorApplication : Game
2626 private const double IntroDuration = 5.0 ; // total
2727 private bool _introClosing ; // true = closing phase (bars sliding in)
2828 private bool _launcherWasOpen = true ;
29+ private IDisposable ? _origamiScope ;
2930
3031 private string _curDefaultFont ;
3132 private string _curDefaultBoldFont ;
@@ -332,10 +333,9 @@ public override void BeginGui(Paper paper)
332333 Selection . UpdatePing ( ( float ) Time . UnscaledDeltaTime ) ;
333334 EditorTheme . TickOrigami ( ( float ) Time . UnscaledDeltaTime ) ;
334335
335- // Push the editor's Origami theme for the remainder of this frame's render. User code
336- // running inside the editor (e.g. game UI in play mode) can override locally with its
337- // own PushTheme, or read Origami.Root directly for the unmodified default.
338- using var origamiScope = EditorTheme . PushOrigami ( ) ;
336+ // Push the editor's Origami theme persists until EndGui disposes it
337+ _origamiScope ? . Dispose ( ) ;
338+ _origamiScope = EditorTheme . PushOrigami ( ) ;
339339
340340 // Detect project opened (launcher closed since last frame)
341341 if ( ! ProjectLauncher . IsOpen && ! _introClosing && _launcherWasOpen )
@@ -687,6 +687,10 @@ public override void EndGui(Paper paper)
687687 _introTime += introDelta ;
688688 DrawIntro ( paper ) ;
689689 }
690+
691+ // Pop the editor Origami theme now that all rendering (including overlays) is done.
692+ _origamiScope ? . Dispose ( ) ;
693+ _origamiScope = null ;
690694 }
691695
692696 private const int BarCount = 10 ;
0 commit comments