Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How to make the other gameObject carry out a function.

$
0
0
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(); } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>