I've tried following the Singletons Autoload step by step tutorial both for Godot 2.1.4 and Godot 3 and both have produced the same error which I've been unable to figure out.
When the button in scene_a is clicked the game crashes with the following error "Attempt to call function 'instance' in base 'null instance' on a null instance."
The errors point to _deferred_goto_scene
function which looks like this.
func _deferred_goto_scene(path):
current_scene.free()
var s = ResourceLoader.load(path)
current_scene = s.instance()
get_tree().get_root().add_child(current_scene)
get_tree().set_current_scene(current_scene)
More specifically, it seems something odd is happening in ResourceLoader.load(path). the path variable ( res://scene_b.tscn
) gets passed on correctly to the function but ResourceLoader.load(path)
still seems to return a [Object:null]
. The game therefor crashes on when trying to instance s.
Note that the project I am testing this on is the one downloadable on the mentioned page in the documentation.
Did I miss something or is there something missing from the documentation?