public GameObject GetObjectInQueue(AllPoolTypes type) { if (!poolDictionary.ContainsKey(type)) { Debug.Log("poolDictionary in ObjectPoolLogic doesn't contain any pool of key: " + type.ToString() + ", see AllPoolTypes to see what type that is."); return(null); } // Gets a reference to the obj furthest in the queue, then put it back into the queue. GameObject objFromQueue = poolDictionary[type].Dequeue(); poolDictionary[type].Enqueue(objFromQueue); return(objFromQueue); }