I keep getting data.tree is null after removing the WorldScene and adding it back
in my MainWorld node, the child node of the WorldScene getting that issue is a Canvas Layer node, is there any way to fix it, please help me
class_name MainWorld extends Node2D
var worldScene = preload("res://Scenes/world.tscn")
var gameOverScene = preload("res://Scenes/UI/GameOverScene.tscn")
func _ready():
Global.mainWorld = self
call_deferred("add_child", worldScene.instantiate())
func ChangeToGameOverScene():
call_deferred("remove_child", $World)
call_deferred("add_child", gameOverScene.instantiate())
func ChangeToWorldScene():
remove_child($GameOverScene)
call_deferred("add_child", worldScene.instantiate())