This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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

in Engine by (43 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.