Is the deafult value on a exported drop down list broken?

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

So I have this very simple line of code:

export (String, "Fire Rate", "Charge", "Cooldown", "Toggle") var recovery_type

The problem is that when I create a new resource with this script attached to it, it does show “Fire Rate” as the default value but printing it reveals that it’s just an empty string.

In the editor, I can change this to a different value and then back to “Fire Rate” and it will show the arrow to revert it back to the default value… of “Fire Rate”. But this new modified “Fire Rate” does show when printing the variable in testing.

So am I missing something? Or are you supposed to always set the value manually when exporting a list variable?

:bust_in_silhouette: Reply From: Inces

You didn’t specify default value. Exported variable is introduced as null. Editor just shows first option in the list, if it is not confirmed, it stays null.

But You can just do this :

export (String, "Fire Rate", "Charge", "Cooldown", "Toggle") var recovery_type = "Fire Rate"

Now that you mention it, it does make sense that it works that way, it’s just that the editor likes to mislead you into thinking the default value is selected. Thanks

TempestDahlia | 2022-09-14 16:31

Unfortunately, this type of strat doesn’t seem to be working for Exported Arrays of dropdowns

RagingDisappointment | 2022-09-23 17:04