add_child / legible_unique_name not working?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rogeriodec

In this code:

extends Spatial

var cilindro = preload("res://Cilindro.tscn")
var c = cilindro.instance()

func _ready():
	var g = $Grupo_Cilindros
	g.add_child(c) 
	print (g.get_children())

I get the result: [[RigidBody:1133]]

Changing the ‘add_child’ line to g.add_child(c, true) I also get [[RigidBody:1133]].

What am I missing?

:bust_in_silhouette: Reply From: volzhs

[[RigidBody:1133]] is not a name, it’s a reference.
try print(c.name) to see if it works.