diff --git a/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx b/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx index 7c04e6652..6c43d42c6 100644 --- a/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx +++ b/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx @@ -22,6 +22,8 @@ import openfl.net.FileReference; class StageOffsetSubstate extends MusicBeatSubstate { + var uiStuff:Component; + override function create() { super.create(); @@ -31,7 +33,7 @@ class StageOffsetSubstate extends MusicBeatSubstate FlxG.camera.target = null; var str = Paths.xml('ui/stage-editor-view'); - var uiStuff:Component = RuntimeComponentBuilder.fromAsset(str); + uiStuff = RuntimeComponentBuilder.fromAsset(str); uiStuff.findComponent("lol").onClick = saveCharacterCompile; uiStuff.findComponent('saveAs').onClick = saveStageFileRef; @@ -96,6 +98,11 @@ class StageOffsetSubstate extends MusicBeatSubstate thing.alpha = 1; } + if (uiStuff != null) + remove(uiStuff); + + uiStuff = null; + PlayState.instance.resetCamera(); FlxG.mouse.visible = false; close();