I'm making a game where a projectile can hit several things. Depending on the tag, the object that would hit would have a function activated by the projectile. I'm also planning of having several enemies with the same scripts and I don't want to affect all of their scripts at once, but just the ones that are hit, similar to Game Maker's "other" function.
How would you say "other" in this situation?
function OnTriggerEnter(collision : Collider){
if(collision.gameObject.tag == "Enemy"){
/*?other?*/takeDamage();
}
}
↧