Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Fyodot |
I’m still relatively new to Godots node system and try to understand how to best access certain nodes, but I’ve run into issues with my lacking understanding of runtime-generated nodes/scenes.
I made two scenes to understand Dialogue boxes, scene 1) and scene 2).
Scene 1) is called scn_Dia.tscn, which contains a root control node called Dia. Underneath are a bunch of irrelevant nodes, and a label called DebugText.
Scene 2) is called scnTst_calling, Node2D as a root node, and another Node 2D called TextboxPos. 2) also has a button, sole function is to generate 1) on the push of a button during runtime.
func _on_Button_pressed():
print("Loading...")
var dialoguebox = preload("res://Testscenes/scn_Dia.tscn")
var instance = dialoguebox.instance()
$TextboxPos.add_child(instance)
print($TextboxPos.get_children())
This is working so far, and the debugger prints the children of I think the runtime generated version of Dia:
[Dia:[Control:1285]]
How can I get the label in the runtime generated scene, and tell it to display a different text?