Skip to content

Commit

Permalink
fix(scenes): process cached scenes properly
Browse files Browse the repository at this point in the history
  • Loading branch information
yusdacra committed Dec 7, 2024
1 parent 08dd913 commit a700316
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addons/scenes/scenes.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ func _set_new_scene(resource: PackedScene) -> void:
## (and any other signal) otherwise it will run every time a scene is changed.
func change_scene_to(path: String, params = {}) -> Signal:
_params = params
_loader_mt.resource_loaded.connect(_set_new_scene, CONNECT_ONE_SHOT)
_loader_mt.load_resource(path)
var maybe_resource = _loader_mt.load_resource(path)
change_started.emit(path, params)
if maybe_resource:
call_deferred("_set_new_scene", maybe_resource)
return scene_changed
else:
_loader_mt.resource_loaded.connect(_set_new_scene, CONNECT_ONE_SHOT)
return scene_changed

0 comments on commit a700316

Please sign in to comment.