Hello - Will here,
After creating a short script (supplied bellow) I have noticed an error occurring:
When the enemy touches the player, rather than taking the 10 health away, an error message is broadcasted; “NullReferanceException: Object Referance not set to an instance of an object.”
I am assuming this is what is stopping the health from being taken away.
Many Thanks, Will.
var health = 100;
var healthcount : Transform;
var enemy : Transform;
function Update () {
healthcount.transform.GetComponent.<TextMesh>().text = health.ToString();
}
function OnTriggerEnter (other : Collider) {
if (other.Collider.enemy){
health -= 10;
}
}