How to access the data of a packed scene or any better approach to getting the data of an node to a button

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nikola-Milovic

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://forum.godotengine.org/32818/export-variables-scene-without-loading-completely-memory
tried this but they say it isnt fully optimized