/// <summary>
        /// Initializes the Sirenix serialization system to be compatible with Unity.
        /// </summary>
        public static void Initialize()
        {
            if (!initialized)
            {
                lock (LOCK)
                {
                    if (!initialized)
                    {
                        try
                        {
                            // Ensure that the config instance is loaded before deserialization of anything occurs.
                            // If we try to load it during deserialization, Unity will throw exceptions, as a lot of
                            // the Unity API is disallowed during serialization and deserialization.
                            GlobalSerializationConfig.LoadInstanceIfAssetExists();

                            CurrentPlatform = Application.platform;

                            if (Application.isEditor)
                            {
                                return;
                            }

                            ArchitectureInfo.SetRuntimePlatform(CurrentPlatform);

                            //if (CurrentPlatform == RuntimePlatform.Android)
                            //{
                            //    //using (var system = new AndroidJavaClass("java.lang.System"))
                            //    //{
                            //    //    string architecture = system.CallStatic<string>("getProperty", "os.arch");
                            //    //    ArchitectureInfo.SetIsOnAndroid(architecture);
                            //    //}
                            //}
                            //else if (CurrentPlatform == RuntimePlatform.IPhonePlayer)
                            //{
                            //    ArchitectureInfo.SetIsOnIPhone();
                            //}
                            //else
                            //{
                            //    ArchitectureInfo.SetIsNotOnMobile();
                            //}
                        }
                        finally
                        {
                            initialized = true;
                        }
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes the Sirenix serialization system to be compatible with Unity.
 /// </summary>
 private static void Initialize()
 {
     if (!initialized)
     {
         lock (LOCK)
         {
             if (!initialized)
             {
                 // Ensure that the config instance is loaded before deserialization of anything occurs.
                 // If we try to load it during deserialization, Unity will throw exceptions, as a lot of
                 // the Unity API is disallowed during serialization and deserialization.
                 GlobalSerializationConfig.LoadInstanceIfAssetExists();
                 initialized = true;
             }
         }
     }
 }