void Awake() { if (Pooler.Instance != null) { Debug.LogError("Pooler already initialized"); } else if (Pooler.Instance == null) { Pooler.Instance = this; initlializePooler(); } }
void Update() { if (this.gameObject.activeInHierarchy) { this.time += Time.deltaTime; if (this.time > this.lifetime) { Pooler.returnObjectToPool(this.gameObject); this.time = 0f; } } }