Пример #1
0
        public void Dispose()
        {
            if (!IsCreated)
            {
                throw new ArgumentException("The World has already been Disposed.");
            }
            // Debug.LogError("Dispose World "+ Name + " - " + GetHashCode());

            if (allWorlds.Contains(this))
            {
                allWorlds.Remove(this);
            }

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            m_AllowGetManager = false;
#endif
            // Destruction should happen in reverse order to construction
            ScriptBehaviourManager em = null;
            for (int i = m_BehaviourManagers.Count - 1; i >= 0; --i)
            {
                var mgr = m_BehaviourManagers[i];
                if (mgr is EntityManager)
                {
                    em = mgr;
                    continue;
                }
                try
                {
                    mgr.DestroyInstance();
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }

            // Destroy EntityManager last
            if (em != null)
            {
                try
                {
                    em.DestroyInstance();
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }

            if (Active == this)
            {
                Active = null;
            }

            m_BehaviourManagers.Clear();
            m_BehaviourManagerLookup.Clear();

            m_BehaviourManagers      = null;
            m_BehaviourManagerLookup = null;
        }
Пример #2
0
        public void DestroyManager(ScriptBehaviourManager manager)
        {
            CheckGetOrCreateManager();

            RemoveManagerInternal(manager);
            manager.DestroyInstance();
        }
Пример #3
0
 public void DestroyManager(ScriptBehaviourManager manager)
 {
     RemoveManagerInteral(manager);
     manager.DestroyInstance();
 }