Godot 4.4.1
Hi! I would like to know if am I getting something wrong here or it is just that this is not yet a feature of the editor.
I have a Multiplayer
class that exposes a custom enum that I can access from other scripts.
As you can see, it works just fine.
The problem comes when I try to use the custom enum as a type for an exported variable.

No class member appears as an option for auto completion. Note this only has to do with typing!
Would appreciate any confirmation that this is indeed just a shortcoming of the editor. That or I just may be wrong 
As far as I know you can just directly reference the enum by name, without first referencing the class it’s in.
Does not seem to be the case for custom enums.
I did a bit of testing, you can simply set the export variable to be an int, as enums are pretty much just numbers.
So you can do:
@export var bartest: int
And lower you can simply set it as such:
test_script.FooBar.Foo;
Where, at least for me, Godot offers autocomplete:
Oh yeah, that’s absolutely possible. However, that’s not my use case right now. I really like enums being explicit in the properties dock. That’s why I use them
.
It just seems to be that type hinting for custom enums do not work on the @export
line.
1 Like
That you can simply achieve like this:
@export_enum("Local", "Online") var bartest: int
That’s still not what I’m having issues with
. What I’m specifically looking for is using the already defined custom enum in a different script. Redefining it with @export_enum
would be redundant. This is specifically an issue that has to do with typing autocompletion.
Still, I appreciate the help. 
1 Like
I’m not sure that’s possible, at least all the examples in the documentation has the enum already inside the same script that gets exported, hence why the export_enum
exists.
But I’m sure someone can correct me on that, I mostly use C#, not GDScript
Should be a feature, maybe not implemented, maybe a regression. Autocomplete has had a lot of work in the last few releases, but there is always room for improvement.
1 Like
Ah, no, I take it back. Your original script should work just fine:

The editor might not offer it, but it will work:

Autocomplete, when writing said export, wasn’t offered, but if you know it’s name, it will work.
So unless you need autocomplete WHILE writing that @export
line, this should work. But this will do what you expect, and the exported variable will change based on the enum defined in your other script file.
1 Like
Welp, that’s it for now I guess then. Maybe at some point it will be corrected. Thanks 