Trying to use child node name as variable

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

trying to use the child node’s name as a variable to be used later but after grabbing it its returned with a wierd thing on the end sorry im very new to godot fire time using
func _on_pressed():
AlwaysLoads.P1Character = get_child(0)

returns this:
sprite2:<AnimatedSprite2D#32061261111>

is there any way to only grab the first part of the thing before the :

it should be: get_child(0).name, if I’m not mistaken

Looks like you might also be able to use .get_name()

thank you lol this worked perfectly!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.