In Unity C#,
This enum code make errors on the console at runtime only.
[System.Flags]
private enum ActionSet : long
{
Sit = 0x0000000000000001,
Stand = 0x0000000000000002,
Walk = 0x0000000000000004,
Sleep = 0x0000000000000008,
Run = 0x0000000000000010,
Happy = 0x0000000100000000,
Sleepy = 0x0000000200000000,
Gloomy = 0x0000000400000000
}
The error is:
Unsupported enum type ‘Character.ActionSet’used for field 'blrah blrah' in class ‘Character’
Unity C# support int type only?
And no problem to use this code?
The issue is Unity's enum serializer expects a 32bit value only. Some possible workarounds:
Use [NonSerialized] attribute.
Store the value in a underlying type (long in your example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With