Replies: 2 comments 7 replies
-
I believe I can safely say that this is the unlikely expectation, given how most options for enum properties in the Inspector (and Project/Editor Settings) are capitalized. It is true that without the original underscores and casing, there might be duplicates. In a typical project, however, this is highly unlikely, given all constants (especially within an enum) are expected to follow the same casing convention. |
Beta Was this translation helpful? Give feedback.
-
I'd say that the dropdown menu is not showing enum keys, it's showing human-readable names for each enum value. The thing is, we auto-generate those names by capitalizing One workaround is to use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using @export with a variable of an enum type the keys are formatted such that the first letter of each word is uppercased and underscores are removed.
I would expect that an enum key be displayed as defined and not be formatted in any way by the inspector.
The underscore and casing are integral parts of the value.
For example this line is perfectly valid syntax in GDScript:
enum {ONE, _ONE, one}
Each of these enum keys will be displayed as "One" in the inspector. That's not good.
Enum keys are values when an enum type is exported. Very much like an exported string value.
If you
@export var my_string:String = "my_value"
The editor keeps case and underscore.
Similarly, enum keys should not be modified in any way.
Beta Was this translation helpful? Give feedback.
All reactions