Send Message to Raycast hit object

Hi all !

I have a little problem :

I try to program this event : when my raycast hit an object with the tag “enemy”, a message is sent to this object.

This is the beginning of my code :

function Impact () {

var pointImpact : RaycastHit;
var degats = Random.Range(25, 37);

    if(Physics.Raycast(transform.position, transform.TransformDirection(Vector3(Random.Range(-0.02, 0.02), Random.Range(-0.02, 0.02), 1)), pointImpact, 250)){
   
        if(pointImpact.collider.tag == "Ennemi") {
///////////// How to send the message to the hited object ?
        }
           
    }
   
}

Your help is welcome :wink:

Cordially, SergentRock.

pointImpact.transform.gameObject.SendMessage(…)

Thank you very much :slight_smile:

A quicker way : pointImpact.collider.SendMessage("SomeMethod");