// OnTriggerExit2D is called when the Collider2D other has stopped touching the trigger (2D physics only) private void OnTriggerExit2D(Collider2D collision) { Destroyable dest = collision.GetComponent <Destroyable>(); if (dest != null) { dest.ExitDestroy(); } else if (collision.GetComponent <PlayerController>() != null) { collision.GetComponent <PlayerController>().Dead(); } else { // Destroy(collision.gameObject); } }