SuperTiled2Unity
SuperTiled2Unity copied to clipboard
FindXXXBySignature problem with Enums
Hi, i'm trying to use int Enums in Tiled for custom properties for Prefab Replacement and they don't work. The problem is that Enum are int32 in Tiled, but in Unity they are...well. enums (type like MyCustomEnumName+Value) and FindPropertyBySignature FindMethodBySignature FindFieldBySignature cannot match the types.
U can fix FindFieldBySignature adding an || (info.FieldType.IsEnum && valueType== Type.GetType("System.Int32"))) To the check of valueType:
private static FieldInfo FindFieldBySignature(Component component, string name, Type valueType) { return component.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public).Where( info => !info.IsInitOnly && info.Name == name && (info.FieldType == valueType || (info.FieldType.IsEnum && valueType== Type.GetType("System.Int32"))) ).FirstOrDefault(); }
Same thing with other 2 Find