system
November 30, 2021, 6:49am
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
stryker31313
Basically, what is the new syntax?
In Godot 3 its something like
export(String, “Rebecca”, “Mary”, “Leah”) var character_name
But with the new format, gots no clue. All help appreciated.
system
December 3, 2021, 12:39am
2
Reply From:
Bird202
Hope this helps. This should let you export the dropdown list into the inspector.
@export_enum (String, “Rebecca”, “Mary”, “Leah”) var character_name
Good luck
Edit: There should be an underscore between “export” and “enum”, for some reason it gets edited out.
this doesn’t work for me. error about needing a range of ints, not strings.
reydev | 2022-11-12 19:29
Sorry, I did that in Godot 4 Alpha. I just checked the documentation and it seems the language would be
@export_enum (“Rebecca”, “Mary”, “Leah”) var enum_name
The documentation is located at @GDScript — Godot Engine (latest) documentation in English .
I tested this in Godot 4 Beta 3. I believe it should work in Beta
Good luck and sorry for the delay in answering.
Bird202 | 2022-11-12 23:31
Sorry, I did that in Godot 4 Alpha. I just checked the documentation and it seems the language would be
@exportenum (“Rebecca”, “Mary”, “Leah”) var enumname
The documentation is located at @GDScript — Godot Engine (latest) documentation in English .
I tested this in Godot 4 Beta 3. I believe it should work in Beta
Good luck and sorry for the delay in answering.
Bird202 | 2022-11-13 03:10
no worries! your example works, thanks!
reydev | 2022-11-15 16:17
Reply From:
Losatu
This example works for me in Godot 4 Alpha 7.
enum FACTION {All, D, A}
@export var faction_to_print : FACTION
system
December 18, 2022, 8:41pm
4
Reply From:
luislodosm
From Godot 4:
@export_enum("Rebecca", "Mary", "Leah") var character_name: String
@export_enum("Warrior", "Magician", "Thief") var character_class: int
@export_enum("Slow:30", "Average:60", "Very Fast:200") var character_speed: int