So I’m working on a Asteroids like game where I want the asteroids to be destroyed and add some points to the score whenever they leave the play-area (defined by a Circle trigger). However, for some reason whenever an asteroid is destroyed inside the play-area the OnTriggerExit2D function is called. This is not the desired since it will then add points to the score. I’m fairly sure this was not how OnTriggerExit2D worked previously.
void OnTriggerExit2D(Collider2D other){
if (other.tag == "Asteroid") {
GameManager.instance.AddScore(scoreToAdd);
other.GetComponent<Asteroid> ().DestroyAsteroid ();
}
}
Any Ideas on how I can check if asteroid has actually left the play-area or if it has been destroyed in some other way?
Thanks.