So basically I have two scripts, the enemy health script that I attach to the enemy that goes as follows.
#pragma strict
var Health = 100;
var animDie : AnimationClip; // Drag your animation from the project view in here (to inspector)
function ApplyDammage (TheDammage : int)
{
Health -= TheDammage;
if(Health <= 0)
{
Dead();
}
}
function Dead()
{
GetComponent.<Animation>().Play(animDie.name);
Destroy(this.gameObject, animDie.length);
}
I also have the script that I attach to my Bullet, that goes as follows…
#pragma strict
function OnCollisionEnter (col : Collision)
{
if(col.gameObject.name == "char4_snipersnest_char4")
{
gameObject.SendMessage("ApplyDammage",100);
}
}
However, when they collide the console says the following: “SendMessage ApplyDammage has no receiver!” I’ve seen some other threads on the SendMessage has no Receiver problem but I can’t quite follow them in my case. Any help here would be massively appreciated. Thanks.