I am trying to build a 3D Turret that will shoot at the player. So far I have the turret shoot and point at the player, However when shot the bullets just keep going and the boundary I made to destroy them isn’t working. I have looked at the space Shooter tutorial on Unity’s site and it isn’t helping.
This is my boundary’s code
You should not use colliders for that. It is much easier (and cheaper) to save the timestamp or position when bullet is fired and check them against current time / current position respectively to enforce limits.
This solution will increase (just a little) your game performance.
It allows you to avoid speeding collision problem when bullet flying so fast it jumps through collider in 2 frames.
Also you won’t hear about FixedUpdate/Update problem when physics cycle skipped during lag.
And one more thing. Executing game logic code in physics cycle (FixedUpdate and OnCollision/OnTrigger messages) is bad practice, avoid it where possible.