Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Reginhowl | |
Old Version | Published before Godot 3 was released. |
Hello Godot Community,
I need help as i don’t know how to set the default value of an exported variable, without selecting on the inspectory by default, it returns a null or empty variable
Here is an example of how it is declared
export (bool) var isInteractable
export(String, "box", "circle", "triangle") var shape
which returns an empty result, unless you click in inspector, and not selecting the first choice as default
I have tried
export (bool) var isInteractable = true
export(String, "box", "circle", "triangle") var shape = "circle"
And it doesn’t seems to work
and declaring the value in func _ready():
seems not practical as it will override the value and inspector not updating real-time.
In short, what im trying to do is to set the default selected choice/parameter or get the first parameter
Sorry if i am confusing, This is my first time posting in godot and I am not an expert programmer, and i might have choose wrong terms. Thank you for your patience.
I did just quick test with export(bool) var bool_export = false # or true
and I got result what I expected.
if you changed default value after you made it once, there should be “restore” icon on right side on inspector.
volzhs | 2017-06-13 17:56
Yes, I don’t know why i did not notice or if i just got confused, but it does really work.
The restore icon really does help a lot
Reginhowl | 2017-06-14 19:56