diff --git a/source/PlayState.hx b/source/PlayState.hx index 560e4dd99..cecedd341 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2732,6 +2732,14 @@ class PlayState extends MusicBeatState }); } + override function switchTo(nextState:FlxState):Bool + { + openfl.utils.Assets.cache.clear(Paths.inst(SONG.song)); + openfl.utils.Assets.cache.clear(Paths.voices(SONG.song)); + + return super.switchTo(nextState); + } + function noteMiss(direction:Int = 1):Void { // whole function used to be encased in if (!boyfriend.stunned) diff --git a/source/TitleState.hx b/source/TitleState.hx index 4c793684a..05e6863d7 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -465,6 +465,13 @@ class TitleState extends MusicBeatState FlxG.sound.play(Paths.sound('confirmMenu'), 0.7); transitioning = true; // FlxG.sound.music.stop(); + + // These assets are very unlikely to be used for the rest of gameplay, so it unloads them from cache/memory + // Saves about 50mb of RAM or so??? + Assets.cache.clear(Paths.image('gfDanceTitle')); + Assets.cache.clear(Paths.image('logoBumpin')); + Assets.cache.clear(Paths.image('titleEnter')); + #if newgrounds if (!OutdatedSubState.leftState) {