-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exported vars without a default set, of enum types with no entry with a value of 0, show misleading info in inspector #74123
Comments
Also valid with C# exported variables as seen in #76933. |
See also #75555. The inspector should take into account that the property may have the wrong type or value and display it. For example, if the number is out of range, the text should be red and/or an exclamation mark icon should be displayed. In the case of enums, |
This is still the case in 4.2.1. A small warning to use a default value with |
I opened #90756 to show a warning if the default value isn't set (when Still, the inspector should show the actual value and perhaps warn when it's not part of the enum. |
Godot version
v4.0.rc6.official [0cd1483]
System information
Arch Linux
Issue description
In GDScript, when exporting a variable of an enum type that does NOT have an entry with value
0
(zero), and you don't a default value, the inspector looks as if you have selected the first element, but in truth, the value of the variable is0
.Given the following snippet:
The inspector looks like this:
This suggests
bar
is selected, and thusfoo
should be1
.However,
prints
0
(zero).If you do give a default:
the inspector looks exactly the same as it did without the default specified, but the output is the (expected)
1
. As a user, I thus can't tell the difference without inspecting the code.As a user, I expect that whatever is shown in the inspector is a representation of what I'll get when I run the code. So when no default is specified, I expect that either (the inspector shows
0
ornull
) or (the value offoo
ends up beingbar
instead of0
). Ideally, I would like it to do the latter, but I think that the former is technically more correctSteps to reproduce
foo
is set tobar
.0
instead.@export var foo : Foo = Foo.bar
1
.Minimal reproduction project
n/a, but can be supplied if helpful.
The text was updated successfully, but these errors were encountered: