Greetings,
I’m scripting a sword hit to apply damage. The problem is that Unity does not detect any collision.
Here’s the test script,
var damageAmount = 20;
var isHitting : boolean = false;
function OnCollisionEnter (collision : Collision) {
isHitting = true;
if (collision.gameObject.GetComponent(Tagger).canBeHit == true){
collision.gameObject.SendMessage("applyDamage", damageAmount, SendMessageOptions.DontRequireReceiver);
}
}
For some weird reasons, the isHitting boolean does not turn true. Both my object that have the script and the one I hit have a collider.