var Health = 10;
var DamageTake = 1.0;
function OnCollisionEnter(other : Collision){
if(other.Tag=="Player"){
Health = Health - DamageTake;
}
}
var Health = 10;
var DamageTake = 1.0;
function OnCollisionEnter(other : Collision){
if(other.Tag=="Player"){
Health = Health - DamageTake;
}
}
Type “collision” is not a game object so it doesn’t have a tag property. Use other.gameObject
instead.
function OnCollisionEnter(other : Collision){
if(other.gameObject.tag == "Player"){
Health = Health - DamageTake;
}
}
This will do.