#Problem getting scripts of Node2D children

1 messages · Page 1 of 1 (latest)

hollow reef
#

I have a parent Node2D and it has 4 children inside, each one with a script attached.
In this script I did define a few functions and properties... but when I call any of this through the array just created, godot says:

res://scripts/tilemap.gd:22 - Invalid call. Nonexistent function 'set_height' in base 'Node2D (`TilemapFloor`)'.

As you can see, I use the as TilemapFloor cast... after having specified the class_name TilemapFloor on top of the custom script (error appears with and without this cast)

hollow reef
#

Okay here is an update

I managed to have the reference of the chidren with the right type... so I can access properties

just look at the printing of the name of floor.side_layer

but it DOESN'T work with methods ??????... as you can see, it throws an error when calling the function print_something(text: String)

send help 😢

#

OKAAAAAAAY IM STUPID IT SEEMS

as I was using @tool with the other scripts, I had to use @tool in this new script as well or it seems the methods doesn't "exist" yet