0 votes

In Godot, it is possible to export an int as flag bits like this:

[Export(PropertyHint.Flags, "Fire,Wind,Ice,Earth")] int myElement;

But c# (in its magnificent glory) also supports flags:

[Flags]  enum Element {None = 0x0, Fire = 0x1, Wind = 0x2, Ice = 0x4 }

Is there a way to define a [Flags] enum, and export it in godot? For example, i want to do this:

[Flags]  enum Element {None = 0x0, Fire = 0x1, Wind = 0x2, Ice = 0x4 }
[Export(PropertyHint.Flags, "Fire,Wind,Ice,Earth")] int myElementInt;
Element myElementEnum;

public override void _Ready() {
    myElementEnum = (Element) myElementInt
}

But i don't have to write all the values again for each export.

Any ideas?

asked May 26 in Engine by Hedi Sellami (16 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.