void TestPool(BasePool pool) { List <PoolMe> activeObjects = new List <PoolMe>(objCount); Stopwatch watch = new Stopwatch(); watch.Start(); // Perform a repeating test of getting pooled objects and putting them back for (int i = 0; i < testCount; ++i) { // Get and "use" all items in the pool for (int j = 0; j < objCount; ++j) { activeObjects.Add(pool.GetPooledObject()); } // Put all items back in the pool for (int j = objCount - 1; j >= 0; --j) { pool.ReturnPooledObject(activeObjects[j]); activeObjects.RemoveAt(j); } } watch.Stop(); UnityEngine.Debug.Log(string.Format("Completed {0} in {1} ms", pool.GetType().Name, watch.Elapsed.Milliseconds)); }