/// <summary> /// Grabs the default value for the specified type /// </summary> /// <param name="rType"></param> /// <returns></returns> public static object GetDefaultValue(Type rType) { bool lIsValueType = false; #if !UNITY_EDITOR && (NETFX_CORE || WINDOWS_UWP || UNITY_WP8 || UNITY_WP_8_1 || UNITY_WSA || UNITY_WSA_8_0 || UNITY_WSA_8_1 || UNITY_WSA_10_0) lIsValueType = rType.GetTypeInfo().IsValueType; #else lIsValueType = rType.IsValueType; #endif if (lIsValueType) { return(Activator.CreateInstance(rType)); } else { UnityEngine.Vector3 lDummy = new UnityEngine.Vector3(); return(lDummy.GetType().GetMethod("GetDefaultGeneric").MakeGenericMethod(rType).Invoke(lDummy, null)); } }