where does event go?

When I shoot a projectile (call it a bullet) and I hit an object, where do I place the code for something to happen.

For example I shoot an enemy and hit it in a shoot script. I want the enemy to do something, so do I call/find that gameObject and do something with the enemy in the shoot script or can I set an event somehow and have code run in the script attached to the enemy?

Attach some script to the enemy so when he collide with something with tag “Bullet” he do something.
You need to put this code in OnCollisionEnter function or one of the Collision functions of Unity, like:

function OnCollisionEnter(collider: Collision) {

if(collider.transform.tag == "Bullet") {

// reduce the life or something

}

}

Of course the bullet, when instantiated, needs to contain that tag, Bullet.