I have a life counter set up that will destroy my gameObject after it hits 0, however, the object does not get destroyed until after it’s hit one more time when it reaches 0. I would like the object to be destroyed at 0 and not have to be hit once more in order to be destroyed. Here is the code:
using UnityEngine;
using System.Collections;
public class RedBase : MonoBehaviour {
void OnCollisionEnter (Collision col) {
RedLives();
}
public void RedLives() {
if(Lives.redCurLives > 0)
Lives.redCurLives--;
else {
GameOver();
}
}
public void GameOver() {
Destroy(gameObject) ;
}
}