public GameObject SpawnObjectByType(eObjectType type, Transform parent, ePoolName poolName) { GameObject objSpawn = GetObjectByType(type); SpawnPool pool = PoolManager.Pools[poolName.ToString()]; if (pool != null && objSpawn != null) { return(pool.Spawn(objSpawn, parent).gameObject); } #if UNITY_EDITOR Debug.Log("khong spawn duoc!"); #endif return(null); }
public void DespawnObject(GameObject obj, ePoolName poolName) { if (PoolManager.Pools.ContainsKey(poolName.ToString())) { SpawnPool pool = PoolManager.Pools[poolName.ToString()]; if (pool.IsSpawned(obj.transform)) { pool.Despawn(obj.transform); } } else { #if UNITY_EDITOR Debug.Log(poolName + "khong co trong pool"); #endif } }
public void DespawnObjectAfter(GameObject obj, ePoolName poolName, float time) { if (PoolManager.Pools.ContainsKey(poolName.ToString())) { SpawnPool pool = PoolManager.Pools[poolName.ToString()]; pool.Despawn(obj.transform, time); //if (pool.IsSpawned(obj.transform)) //{ // Debug.Log("despawm"); // pool.Despawn(obj.transform,time); //} } else { #if UNITY_EDITOR Debug.Log(poolName + "khong co trong pool"); #endif } }