Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Weizen |
Im trying to get my head around how to use the “Methods” of Nodes like get_tree().get_root()
or remove_and_skip
or any of them.
To make my problem more comprehensible here some short code where i try to delete a ColorRect and a Label out of the scene.
The SceneTree: Node2d → ColorRect → Label
extends Node2D
onready var a = $ColorRect
onready var s = $Label
func _ready():
delete_nodes()
delete_nodes():
get_tree().get_root().remove_and_skip().get_path_to(a)
get_tree().get_root().remove_and_skip().get_path_to(s)
This is probably completely wrong. I tried to understand the Docs but i got confused, maybe i miss something? help me correct it pretty please and thank you for your time <3