I m upgrading a project from Godot 3 to Godot 4. In Godot 3 I had an export variable that was an array of bit flags. This essentially allowed me to set the number of a given item and set bit flags for each of the items.
Example:
export (Array, EnumOfFlags, FLAGS) var items:= [0, 1]: setget = _set_items
In upgrading to Godot 4, when I switch to the @export_flags
syntax I m running into two problems.
@export_flags
won t accept an enum as an argument. I get this error when I try supplyingEnumOfFlags
as the only argument:Invalid argument for annotation "@export_flags": argument 1 should be "String" but is "EnumOfFlags"
. This is annoying since using an enum allows me to reuse and reference the flags really cleanly. I can work around this.@export_flags
requires the variable to be an integer and doesn t like the concept of an array of bit flags. I get this error when I try to assign the array above as the default value:"@export_flags" annotation requires a variable of type "int" but type "Array" was given instead.
. This is more problematic since I want different flags for each item. I can think of some possible workarounds but they involve writing significantly more code.
Are either of these still possible in Godot 4? The docs suggest there are more advanced exports but the advanced exports section seems to be incomplete (it gives some things you should be familiar with before reading more but then ends).