I want to increment the player’s score when they successfully clear a box. To do this, I have one collider on the box for collisions, and one trigger over the box to see if the player is on top of it.
[19391-screen+shot+2013-12-15+at+11.51.37+am.png|19391]
I have this script attached to the player to increment the score:
public int score = 0;
void OnTriggerExit2D(Collider2D col){
if (col.gameObject.tag == "Obstacle")
score++;
}
OnTriggerExit2D does not get called in this script, but if I change it to OnTriggerEnter2D it does. I cannot use that, because it constantly increments the score while the player is in the trigger. How can I fix this?