private void OnTriggerExit(Collider other) { --count; if (count > 0) { return; } PoolManagerScript.Despawn(spawnedLevel); }
/// <summary> /// Called by the spawned object to destroy itself on this managing component. /// For example when it has been collected by players. /// </summary> public void Destroy() { //despawn object and clear references PoolManagerScript.Despawn(obj); obj = null; }