- Home /
Destroy issue.
I am using Destroy(gameObject.FindWithTag("projectile"));
to destroy it after it hits Enemy.
It works fine when I shoot only one projectile but as soon as I shoot more than one, the projectile goes right thru enemy and keeps on flying withouth destroying.
I have Sphere Colider covering whole Enemy.
How can I fix this?
Answer by Anxo · Oct 31, 2011 at 06:54 PM
You can just add
Destroy(gameObject) in the OnCollisionEnter and ad that script to the projectile instead of on the character.
if you need it on the character you can do sometthing like if(other.comparetag == "projectile") { Destroy(other.gameObject) in the collision enter event.
Your answer
Follow this Question
Related Questions
Teleporting projectiles, and maintaining speed 3 Answers
Making projectiles disappear when they hit the ground 2 Answers
Different scores with OnTriggerEnter Destroy 1 Answer
Projectile not destroying game object 1 Answer
check when a projectile that is a trigger hits a mesh that is also a trigger 1 Answer