So I have a button that I want to feed PackedScenes of buildings. I wanna reuse the button and just swap out the PackedScenes for buildings. The buildings would have the icon, name, cost that I want to get into the button. The buildings are .tscn. Is there any other way of doing this? I was thinking of scriptable objects to hold the data for the buildings but I am not familiar with that. I want something that's not resource heavy and without instancing the scene in the button. Can I use preload in the button and then the building will already be loaded for future uses? Is that better for perfomance?
export (PackedScene) var tscn
var building_cost
var building_name
func _ready():
#get the data from the tscn and set it as building name and cost
self.texture_normal = texture
func _on_BuildingButton_pressed():
Events.emit_signal("building_ButtonPressed", building_cost, building_name)
https://godotengine.org/qa/32818/export-variables-scene-without-loading-completely-memory
tried this but they say it isnt fully optimized