- Home /
Firing bullets deleats player not bullet
I have a ship that fires a bullet and i want them to be deleted from the game after they are so far away from the ship but when i try to remove them all i can go it to do is remove the ship.
this is the code i am using
if (bullet.position.z < muzzle.position.z + 100){ Destroy (gameObject); }
Comment
Answer by jogo13 · Dec 18, 2012 at 04:31 AM
try this (changed gameObject to bullet.gameObject):
if (bullet.position.z < muzzle.position.z + 100){ Destroy (bullet.gameObject); }