-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi !
I searched for a plugin like yours because having my scene loading at start makes my game a bit long to load so I wanted to delay some loading while the player is in the menus.
I managed to get the plugin to work even if I'm in 2D, but for some reasons I still get little lag spikes when it loads.
I don't know exactly what could cause this,
Here is basically the code I'm using (I removed all "position" related args everywhere as I don't need them and it was not compatible with 2D)
Init :
const GROUPS := [
"Foreground",
"UI",
"Background",
]
const SLEEP_MSEC := 100
func _init():
SceneAdder._sleep_msec = 100
SceneAdder.set_groups(GROUPS)
async calls :
func async_load(path,type,to_assign=null):
yield(get_tree(),"idle_frame")
var target
match type:
"canvas":
target = canvas_layer
"background":
target = background
"foreground":
target = foreground
"middle":
target = middle
if to_assign == null:
SceneLoader.load_scene_async(target, path)
else:
SceneLoader.load_scene_async_with_cb(target, path, funcref(self, "handle_load_callback"), {"type":type,"to_assign":to_assign})
Callback :
func handle_load_callback(path : String, instance : Node, data : Dictionary) -> void:
propagate_call("add_"+data.type,[instance])
match data.to_assign:
"fight_scene":
fight_scene = instance
"codex":
codex = instance
AsyncLoadLagSpike.mp4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels