public void Release() { if (pool != null) { pool.Free(gameObject); } else { Destroy(gameObject); } }
// Update is called once per frame void Update() { life -= Time.deltaTime; if (life <= 0) { if (pool != null) { pool.Free(gameObject); } else { Destroy(this); } } }