[gd_scene load_steps=3 format=2] [ext_resource path="res://ControlTree.tscn" type="PackedScene" id=1] [sub_resource type="GDScript" id=1] script/source = "extends Control var i var j func _ready() -> void: pass func _on_Button_pressed() -> void: i = $ControlTree.add_item('test') func _on_Button2_pressed() -> void: j = $ControlTree.add_item('test2', i) func _on_Button3_pressed() -> void: $ControlTree.add_item('test3', j) " [node name="TestArea" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 script = SubResource( 1 ) [node name="ControlTree" parent="." instance=ExtResource( 1 )] [node name="Button" type="Button" parent="."] margin_left = 634.0 margin_top = 48.0 margin_right = 765.0 margin_bottom = 97.0 text = "Add item" [node name="Button2" type="Button" parent="."] margin_left = 634.0 margin_top = 117.0 margin_right = 765.0 margin_bottom = 166.0 text = "Add subitem" [node name="Button3" type="Button" parent="."] margin_left = 634.0 margin_top = 194.0 margin_right = 765.0 margin_bottom = 243.0 text = "Add subsubitem" [connection signal="pressed" from="Button" to="." method="_on_Button_pressed"] [connection signal="pressed" from="Button2" to="." method="_on_Button2_pressed"] [connection signal="pressed" from="Button3" to="." method="_on_Button3_pressed"]