private void OnDestroy()
 {
     if (Main == this)
     {
         Main = null;
     }
 }
Exemple #2
0
        private void Start()
        {
            _poolContainer = new GameObject("Instances").transform;
            _poolContainer.SetParent(transform);
            _poolContainer.gameObject.SetActive(false);
            _internalPool = GameObjectPoolManager.CreatePool(prefab, maxSize, preCache, false, _poolContainer);
            if (dontDestroyOnLoad)
            {
                DontDestroyOnLoad(gameObject);
            }

            if (hideInInspectorOnRun)
            {
                gameObject.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector;
            }
        }
 void Awake()
 {
     _transform           = transform;
     _transform.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy;
     Main = this;
 }