For the most general use of projectiles in a game, stick your code on to your projectile as it would be the object that can initiate a change on whatever it is interacting with.
You would for this apply a collider to the object, set it to “isTrigger” and add a rigidbody (here you may choose to make it “isKinematic” or just uncheck the “useGravity” checkbox and contstrain all posiitons and rotations in the later options for the rigidbody component)
Your receiving object should also have a collider attached, though it is not necessary to set to “isTrigger” on that one.
This then sets up a style for coding triggered collisions.
void OnTriggerEnter(Collider col)
{
//all projectile colliding game objects should be tagged "Enemy" or whatever in inspector but that tag must be reflected in the below if conditional
if(col.gameObject.tag == "Enemy")
{
Destroy(col.gameObject);
//add an explosion or something
//destroy the projectile that just caused the trigger collision
Destroy(gameObject);
}
I have given you a trigger solution due to Triggers being a little more efficient at runtime over OnCollisionEnter() or raycasting(Physics.RayCast)-both options that may otherwise suit you, but are more expensive to use overall).
This isnt a quote from Will Goldstone, but it sure stayed in my head form his Unity3X Game Development Essentials book, an excellent early resource.
Cheers bud and hope that helped in some way.
take care
Gruffy