Example #1
0
        public void load()
        {
            lock (m_Locker)
            {
#if UNITY_EDITOR
                if (m_AssetVersion < GAFSystem.AssetVersion &&
                    !EditorApplication.isPlayingOrWillChangePlaymode)
                {
                    upgrade();
                }
#endif // UNITY_EDITOR

                if (m_AssetVersion == GAFSystem.AssetVersion)
                {
                    if (!isLoaded &&
                        m_AssetData != null)
                    {
                        GAFReader reader = new GAFReader();
                        try
                        {
                            reader.Load(m_AssetData, ref m_SharedData);
                        }
                        catch (GAFException _Exception)
                        {
                            GAFUtils.Error(_Exception.Message);

                            m_SharedData = null;
                        }

                        if (isLoaded &&
                            !m_IsExternalDataCollected)
                        {
                            collectExternalData();

#if UNITY_EDITOR
                            if (!EditorApplication.isPlayingOrWillChangePlaymode)
                            {
                                EditorUtility.SetDirty(this);
                            }
#endif // UNITY_EDITOR
                        }
                    }
                }
                else
                {
                    GAFUtils.Log("Asset \"" + name + "\" was not upgraged!", string.Empty);
                }
            }
        }
Example #2
0
    public void load()
    {
        lock (m_Locker)
        {
#if UNITY_EDITOR
            m_GUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(this));

            m_Version = GAFSystem.Version;
#endif // UNITY_EDITOR

            if (!isLoaded)
            {
                if (m_AssetData != null)
                {
                    GAFReader reader = new GAFReader();
                    try
                    {
                        reader.Load(m_AssetData, ref m_SharedData);
                    }
                    catch (GAFException _Exception)
                    {
                        GAFUtils.Error(_Exception.Message);

                        m_SharedData = null;
                    }
                }
            }

            if (isLoaded)
            {
#if UNITY_EDITOR
                if (!m_IsObjectsCollected)
                {
                    initObjectsLists();
                }
#endif // UNITY_EDITOR
            }
        }
    }
        public void load()
        {
            lock (m_Locker)
            {
            #if UNITY_EDITOR
                if (m_AssetVersion < GAFSystem.AssetVersion &&
                    !EditorApplication.isPlayingOrWillChangePlaymode)
                {
                    upgrade();
                }
            #endif // UNITY_EDITOR

                if (m_AssetVersion == GAFSystem.AssetVersion)
                {
                    if (!isLoaded &&
                         m_AssetData != null)
                    {
                        GAFReader reader = new GAFReader();
                        try
                        {
                            reader.Load(m_AssetData, ref m_SharedData);
                        }
                        catch (GAFException _Exception)
                        {
                            GAFUtils.Error(_Exception.Message);

                            m_SharedData = null;
                        }

                        if (isLoaded &&
                            !m_IsExternalDataCollected)
                        {
                            collectExternalData();

            #if UNITY_EDITOR
                            if (!EditorApplication.isPlayingOrWillChangePlaymode)
                                EditorUtility.SetDirty(this);
            #endif // UNITY_EDITOR
                        }
                    }
                }
                else
                {
                    GAFUtils.Log("Asset \"" + name + "\" was not upgraged!", string.Empty);
                }
            }
        }