Godot Version
4.4
Question
Hello there,
I’m trying to dynamically setup some play pieces, setting a script on them:
for child_node in puzzle_scene.get_children():
if not child_node.name.begins_with("piece_"):
continue
child_node.set_script("res:puzzlepiece.gd")
var piece = child_node as PuzzlePiece
piece.setup(Vector3(3,3,3), Vector3(2,2,2))
I can see the _init() function being called but when I cast to the type of the script I get NIL. I can also not call my function without casting, I get an error that the function doesn’t exist.
What am I missing?
Thanks for any hints!
seb