Namespace: | Sirenix.Serialization |
Assembly: | Sirenix.Serialization |
public static class FormatterUtilities
Unity uses these kinds of values to indicate missing object references.
public static Object CreateUnityNull(Type nullType, Type owningType)
System.Type | nullType | Type of the null value. |
System.Type | owningType | Type of the owning value. This is the value which changes the UnityEngine.MissingReferenceException which you get. |
UnityEngine.Object | A fake Unity null value of a given type. |
System.ArgumentNullException | The nullType or owningType parameter is null. |
System.ArgumentException | The type given in the nullType parameter is not a Unity object. or The type given in the owningType parameter is not a Unity object. |
public static Type GetContainedType(MemberInfo member)
System.Reflection.MemberInfo | member | The System.Reflection.MemberInfo to get the contained type of. |
System.Type | The type contained in the given System.Reflection.MemberInfo. |
System.ArgumentException | Can't get the contained type of the given System.Reflection.MemberInfo type. |
public static object GetMemberValue(MemberInfo member, object obj)
System.Reflection.MemberInfo | member | The System.Reflection.MemberInfo to get the value of. |
System.Object | obj | The instance to get the value from. |
System.Object | The value contained in the given System.Reflection.MemberInfo. |
System.ArgumentException | Can't get the value of the given System.Reflection.MemberInfo type. |
public static MemberInfo[] GetSerializableMembers(Type type, ISerializationPolicy policy)
System.Type | type | The type to get serializable members for. |
Sirenix.Serialization.ISerializationPolicy | policy | The serialization policy to use. If null, Strict is used. |
System.Reflection.MemberInfo[] | An array of all serializable members on the given type. |
public static Dictionary<string, MemberInfo> GetSerializableMembersMap(Type type, ISerializationPolicy policy)
System.Type | type | The type to get a map for. |
Sirenix.Serialization.ISerializationPolicy | policy | The serialization policy to use. If null, Strict is used. |
System.Collections.Generic.Dictionary<System.String, System.Reflection.MemberInfo> | A map of all serializable members on the given type. |
The following types are primitive array types: System.Char, System.SByte, System.Int16, System.Int32, System.Int64, System.Byte, System.UInt16, System.UInt32, System.UInt64, System.Decimal, System.Boolean, System.Single, System.Double and System.Guid.
public static bool IsPrimitiveArrayType(Type type)
System.Type | type | The type to check. |
System.Boolean |
|
The following criteria are checked: type.IsPrimitive or type.IsEnum, or type is a System.Decimal, System.String or System.Guid.
public static bool IsPrimitiveType(Type type)
System.Type | type | The type to check. |
System.Boolean |
|
public static void SetMemberValue(MemberInfo member, object obj, object value)
System.Reflection.MemberInfo | member | The System.Reflection.MemberInfo to set the value of. |
System.Object | obj | The object to set the value on. |
System.Object | value | The value to set. |
System.ArgumentException | Property has no setter or Can't set the value of the given System.Reflection.MemberInfo type. |