public void TryPoolObject(Resetter resetter) { if (!pool.Contains(resetter)) { return; } resetter.gameObject.SetActive(false); resetter.transform.localPosition = spawnLocalPosition; freePooledObjectCount++; }
public void SpawnNextObject() { if (this.enabled && HasFreePooledObject) { Resetter resetter = pool.FirstOrDefault(resetter => resetter.gameObject.activeSelf == false); if (resetter != null) { resetter.Reset(); resetter.gameObject.SetActive(true); freePooledObjectCount--; } } }