So i have a script, and I have poked around for many hours but i cant find out how to make the health count decrease when a set gameObject enters the collider.
In my its a zombie and when the fps controller enters it will decrease in health.
The Is Trigger is checked.
anyone know how to do this?
thanks and heres my script:
using UnityEngine;
using System.Collections;
public class HealthCount : MonoBehaviour {
public int health = 100;
void Update() {
Debug.Log (health);
if (health <= 0) {
Application.LoadLevel ("GameOver");
}
}
void OnTriggerEnter () {
health--;
}
}