示例#1
0
        private void DestroyPoolObserver()
        {
            if (_poolObserver != null)
            {
                _poolObserver.Deactivate();

                if (_poolObserver.entitiesContainer != null)
                {
                    Destroy(_poolObserver.entitiesContainer);
                }

                _poolObserver = null;
            }
        }
示例#2
0
        private void SetupPoolObserver()
        {
            //	Optional debugging (Its helpful.)
#if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR)
            //TODO: Sometimes there are two of these in the hierarchy. Prevent that - srivello
            PoolObserverBehaviour poolObserverBehaviour = GameObject.FindObjectOfType <PoolObserverBehaviour>();
            if (poolObserverBehaviour == null)
            {
                _poolObserver = new PoolObserver(_pool);
                //Set as a child to unclutter hierarchy
                _poolObserver.entitiesContainer.transform.SetParent(transform);
            }
            //Helpful if you want to see the pools in the hierarchy after you STOP the scene. Rarely needed - srivello
            //Object.DontDestroyOnLoad (poolObserver.entitiesContainer);
#endif
        }