Skip to content

Commit

Permalink
fix(Entrypoint): defer add child scene
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Aug 25, 2024
1 parent 16e0207 commit 76dd099
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion entrypoint.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func _ready() -> void:

# Launch the main interface if no child pid exists
if child_pid < 0:
get_tree().change_scene_to_file("res://core/main.tscn")
_change_to_scene("res://core/main.tscn")
return

logger.info("Supervising child process")
Expand All @@ -47,6 +47,14 @@ func _ready() -> void:
add_child(timer)


# Change to the given scene
func _change_to_scene(scene_path: String) -> void:
var scene := load(scene_path) as PackedScene
var root := get_window()
root.add_child.call_deferred(scene.instantiate())
queue_free()


# Applies any update packs to load newer scripts and resources
# TODO: Verify that pack version is not older than current version before
# loading
Expand Down

0 comments on commit 76dd099

Please sign in to comment.