Exemplo n.º 1
0
        public void Instantiate(string id, Transform parent = null, bool worldPositionStays = true, Action <GameObject> onCreate = null)
        {
            _alive = true;
            if (id == _id)
            {
                _instance.transform.SetParent(new RectTransform(), worldPositionStays);
                onCreate?.Invoke(_instance);
            }
            else
            {
                _id = id;
                _assetManager.Load <GameObject>(id, go => {
                    if (_alive)
                    {
                        if (_bInstance)
                        {
                            _pool.Destroy(_instance);
                        }

                        _bInstance = _instance = _pool.Instantiate(go, parent, worldPositionStays);
                        onCreate?.Invoke(_instance);
                    }
                });
            }
        }
Exemplo n.º 2
0
 void DestroyPoolMgr()
 {
     if (_poolMgr != null)
     {
         _poolMgr.Destroy();
         _poolMgr = null;
     }
 }
Exemplo n.º 3
0
    public void Destroy()
    {
        OnDestroy();

        _parentPool.Destroy(this);

        _isChanged = false;
    }