Wait 0.05s while loading resource

This commit is contained in:
JeremyStar™ 2023-09-12 02:13:46 +02:00
parent f9f42095cf
commit 6643152e93

View file

@ -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