I am trying to reset my prototype/main game scene when current_health reaches zero and doing this via a signal from sandbox.gd (attached to vehicle_parent node) to main_world.gd (attached to World).
I am using get_tree().reload_current_scene() to reload the main scene but the game goes grey and crashes. The only errors that are thrown are timer related ones that can’t complete because the game has stopped.
I have also tried get_tree().reload_scene("res://Example World/Objects/World/world.tscn") to reload the scene but get the same results.
Any help, ideas, tips would be greatly appreciated! Cheers!
You can return the value from the reload function, and print it out or just use the debugger to see if actually any error is happening:
Error reload_current_scene()
Reloads the currently active scene.
Returns OK on success, ERR_UNCONFIGURED if no current_scene was defined yet, ERR_CANT_OPEN if current_scene cannot be loaded into a PackedScene, or ERR_CANT_CREATE if the scene cannot be instantiated
Thank you @bananaholograma! I am not getting any errors related to the reload function when the game crashes. Is there a way I can make sure they will show up when get_tree().reload_current_scene() is called? Sorry for not understanding.
I had an await that was trying to fire after during the reload and that was crashing the game. I if conditioned it out “if get_tree():” and that fixed things.