From 6643152e93a9af546e26150ddf1704a17b4f1465 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 12 Sep 2023 02:13:46 +0200 Subject: [PATCH] Wait 0.05s while loading resource --- resmgr.gd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resmgr.gd b/resmgr.gd index ede2057..3145358 100644 --- a/resmgr.gd +++ b/resmgr.gd @@ -42,7 +42,9 @@ func loadres(resource_name:String,resource_path:String,replace:bool = false) -> logger.error("CORE/resmgr.gd",err["error"]) return err["code"] # Load the resource - resources.merge({resource_name:ResourceLoader.load(resource_path)}) + var resource_loaded = ResourceLoader.load(resource_path) + await get_tree().create_timer(0.05).timeout + resources.merge({resource_name:resource_loaded}) return core.Errors.OK # Unloads a resource @@ -67,7 +69,7 @@ func loadbatch(batch:Dictionary,replace:bool = false) -> int: return err["code"] for i in batch: # Call loadres() method for every item in batch - loadres(i,batch[i],replace) + await loadres(i,batch[i],replace) return core.Errors.OK # Unloads a batch of resources