/// <summary> /// Spawn an object from the pool /// </summary> /// <param name="tag">Object Name </param> /// <returns></returns> public GameObject SpwanFrompool(string tag) { if (!pooledDict.ContainsKey(tag)) { Debug.LogWarning("Obeject not found in the pool " + tag); return(null); } GameObject go = pooledDict[tag].Dequeue(); go.SetActive(true); IObjectPool iPool = go.GetComponent <IObjectPool>(); if (iPool != null) { iPool.OnObjectSpawn(); } pooledDict[tag].Enqueue(go); return(go); }