Merge pull request #1694 from loudoweb/dev-fix-library-unload

clear cached files on library unload
This commit is contained in:
player-03
2023-07-04 20:31:03 -04:00
committed by GitHub

View File

@@ -611,7 +611,22 @@ class AssetLibrary
} }
} }
public function unload():Void {} public function unload():Void
{
#if haxe4
cachedBytes.clear();
cachedFonts.clear();
cachedImages.clear();
cachedAudioBuffers.clear();
cachedText.clear();
#else
cachedBytes = new Map<String, Bytes>();
cachedFonts = new Map<String, Font>();
cachedImages = new Map<String, Image>();
cachedText = new Map<String, String>();
classTypes = new Map<String, Class<Dynamic>>();
#end
}
@:noCompletion private function __assetLoaded(id:String):Void @:noCompletion private function __assetLoaded(id:String):Void
{ {