I am following along with yet another tutorial trying to learn to code in unity and up intill now all the many problems i have had i have been able to solve or search for the solution intill now, im trying to make it so that when i get close to an enemy and click the left mouse his life goes down, when the kid in the tutorial plays the code it works but not for me, i have set the enemy’s collier box so its bigger than the object and the trigger works but when i click the mouse it don’t take health. here is the code;
var Health = 3;
var TakeDamage : boolean;
function OnTriggerEnter ( other : Collider ){
if (other.tag == "Player"){
TakeDamage = true;
}
}
function OnTriggerExit ( other : Collider ){
if (other.tag == "Player"){
TakeDamage = false;
}
}
function update (){
if (TakeDamage){
if (Input.GetButtonDown("Fire1")){
Health --;
}
}
}
any help would be great.