// Update is called once per frame void Update() { // after a short TTL the bullets are considered void and returned to the bullet pooler m_timeLeftToLive -= Time.deltaTime; if (m_timeLeftToLive < 0) { m_bulletPooler.ReturnPlayerBulletToPool(gameObject); } }
// return the bullet to the pooler private void Die() { Instantiate(m_impactEffect, transform.position, Quaternion.identity); m_pooler.ReturnPlayerBulletToPool(gameObject); }