Hi folks, struggling hard with integrating a Loading scene in between the main menu & gameplay scenes of my game. I'm using a singleton (GameState) to hold the path of the nextScreen and then switching to the Loading Scene which loads the next scene (specifically: I am trying to load my Tutorial scene, which contains the Playspace & GameEngine)
var loading_status
var progress : Array[float]
@onready var nextScreen = GameState.nextScreen
func _ready():
ResourceLoader.load_threaded_request(nextScreen)
func _process(delta):
loading_status = ResourceLoader.load_threaded_get_status(nextScreen, progress)
match loading_status:
ResourceLoader.THREAD_LOAD_IN_PROGRESS:
progress_bar.value = progress[0] * 100*2 # Change the ProgressBar value
ResourceLoader.THREAD_LOAD_LOADED:
progress_bar.value = 100
if $Timer.time_left == 0:
get_tree().change_scene_to_packed(ResourceLoader.load_threaded_get(nextScreen))
ResourceLoader.THREAD_LOAD_FAILED:
print("Error. Could not load Resource")
When I run the exported file on Android, the progress bar stays at 0 and then the game crashes. Once, it even forced my phone to restart. The code seems to work on my computer (Mac). But even then, some of the signals & on_ready fxns of the loaded scene do not seem to run? Would really appreciate some help as I am very confused!