Possible to destroy projectiles when they leave the screen?

While finishing this lesson and testing, I noticed that a lot of the projectiles remain present for a few seconds after they travel off the screen. Would it be good to put a large collider around the bounds of the screen or play area, and have that destroy projectiles so that it increases performance a tad not having to track irrelevant projectiles?

It’s not really irrelevant projectiles if they are off screen but still in the play area. They could still hit an opponent off screen. However, you can check if the renderer is visible. When it goes off-screen, there is a isVisible flag that will change to false. This is tied to the camera, so if you have both the game window and scene view open it will only be set to false when neither of them can see the renderer. Fortunately it’s only an issue in editor. Considering the off-screen opponents, it’s not a bad idea to put colliders around the play area.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms