I am loading a JSON file, and instantiating scenes based on the JSON. I'm able to preload the scene, set it's position dynamically from the values in the JSON, but I'm confused how I would set other arbitrary data onto a node's script inside the new scene i created.
I have some code like this:
var star = preload("res://Scenes/Stars/Star.tscn").instance()
# this works fine
star.position.x = star_data["x"]
star.position.y = star_data["y"]
# The root node has a script with variables i'd like to set..
# This doesn't complain but not what i want.
# I've tried `get()` to access these attrs after i set them on the node, but that doesn't seem to work.
Is there a different way? star.getnode(".").getscript() is not the instantiated script to be able to set attributes. Looking for the correct pattern for loading data like this.
Thanks for any help, really enjoying learning Godot!