Godot Version
4.2
Question
I have exhausted every search engine for this, but cannot find and answer.
So I have a very simple project with two scenes: A “main” scene and a “square” scene. In the “main” scene I spawn squares periodically.
Now, I want to assign custom data to the squares, e.g.
var square = square_scene.instantiate()
square.my_data = 7 # ← How to do that?
I have tried to attach a script to the square scene with this content:
@export var my_data = 0
But that does not make the variable available.
I am clearly missing something here, because this seems like something that should be very easily possible, like in other programming languages with classes/objects.