extends Node var queue = null var target_scene = null var loading_text = null var loader = preload("res://Scenes/Loader.tscn") func enter_loader(): get_tree().change_scene_to(loader) func load_scene_with_args(scene_path: String, _args: Array): queue = ResourceQueue.new() queue.start() target_scene = scene_path queue.queue_resource(scene_path) func _physics_process(delta): if queue != null and target_scene != null: if queue.is_ready(target_scene): get_tree().change_scene_to(queue.get_resource(target_scene)) queue = null target_scene = null func get_progress(): if loading_text != null: return loading_text if queue != null and target_scene != null: return "Loading scene (" + str(queue.get_progress(target_scene)) + ")"