Issue about SharedVariable<Enum>

Ray

New member
I met an issue about Behavior Designer Editor.

I was trying to cast an Enum to SharedVariable, like

public enum SomeEnum : uint{}

public class SharedSomeEnum : SharedVariable<SomeEnum>{}

And Then added a Conditiaonal to compare two SomeEnum, like

public class CompareSomeEnumValue : Conditional
{
public SharedSomeEnum someEnum1;
public SharedSomeEnum someEnum2;
.....
}

Then, when I drag the CompareSomeEnumValue conditional to the editor, an error was reported:

InvalidCastException: Specified cast is not valid.
BehaviorDesigner.Editor.BinarySerialization.SaveField (System.Type fieldType, System.String fieldName, System.Int32 hashPrefix, System.Object value, System.Reflection.FieldInfo fieldInfo) (at <c907413e7b974c73aba6a97e2cd24327>:0)
......

Seems problem happens in Editor's BinarySerialization.cs, at line:
else if (filedType.Equals(typeof (int)) || fieldType.IsEnum)

Could you help to fix? Make the enum support uint, and byte...
 

Attachments

  • casterror.png
    casterror.png
    355.9 KB · Views: 8
  • problemLine.png
    problemLine.png
    38.6 KB · Views: 6
Thanks for the report. I have this fixed - now enums can have any type as their base class. If you'd like to get this change before the next release send me a PM with your Unity version.
 
Thanks for the report. I have this fixed - now enums can have any type as their base class. If you'd like to get this change before the next release send me a PM with your Unity version.
Thanks Justin, for the quick reaction.
It would be nice if you can send me before next release, so that we can continue working without any trouble.
I will send you a PM ASAP.
 
Top