Godot Version
4.x
Question
Hello, I´m totally new here, and I´m just doing it for fun so pls expect not the smartest Dude…
@onready var AppleTemplate = preload(“res://…tscn”)
@onready var FrüchteKorbListe = preload(“res://…gd”)
# there is an array, Korb, with numbers and the first one is the name
for x in FrüchteKorbListe.Korb:
var Frucht = ApfelTemplate.instantiate()
var Infos = FrüchteKorbListe.Korb[x]
Frucht.set_name(Infos[0])
*#so i have given every instantiated Frucht a diffrent name from the array “Korb” located in FrüchteKorbListe
#I have also added them to groups and as childs and in another array…*
Frucht.add_to_group("x")
$Parentnode1.add_child(Frucht)
Array2.append(Frucht)#falls ich mit Arrays Arbeiten möchte
#i can ask for the name of the first Frucht in the Array2 via
print(Array2[0].get_name());
#it prints Name1
#But I cannot, and i dont know why and thats k1ll1ng me, find the Node in the array2 via the name
if Array2.has(Name1):# error Identifier Name1 not declared
if Array2.has("Name1"):# or something like this...
#I really think it has to with the part, that I didnt name every node unique, because when i write
print(str(Array2));
#it shows [Name1:<Node3D#28001174751>, Name2:<Node3D#28118615270>]
not just Name1,Name2
is there a way i can access thes nodes in the Array2 via the name?
or how can i manually change"#28001174751" i think if i can rename that i can access them.
Thx for YOUR help!!!