Hi all, I am somewhat new to Godot and I'm using 4.02. I'm trying to switch to a new scene like so:
var EffortMain = preload("res://Scenes/EffortMain.tscn").instantiate()
func _on_chat_pressed():
EffortMain.set_task_id(self.id)
get_tree().change_scene_to_packed(EffortMain)
I receive the following error:
E 0:00:01:0748 EffortBarScript.gd:47 @ _on_chat_pressed(): Can't change to a null scene. Use unload_current_scene() if you wish to unload it.
<C++ Error> Condition "p_scene.is_null()" is true. Returning: ERR_INVALID_PARAMETER
<C++ Source> scene/main/scene_tree.cpp:1134 @ change_scene_to_packed()
<Stack Trace> EffortBarScript.gd:47 @ _on_chat_pressed()
It works if I just change the scene via the path, but I have some data I'd like to pass to the instantiated scene. Am I going about this incorrectly?