How much do I need to optimize off-screen objects?

I’m making a basic 2D top-down space shooter. There’s a map you fly around and there are lots of things that are off-screen (asteroids, enemies, bases, etc.). Is it enough to just disable the renderer for these objects while they’re off-screen? Is there more I should be doing to optimize for performance?

Unity uses something that’s called frustrum culling, which basically prevents stuff outside of the screen from being drawn. This is also included in the free version.

So disabling the renderer on objects that are outside the viewport should do exactly nothing. You can check for yourself, just put some large textures outside the screen, turn their renderer on and off, and take a look at your fps. There will probably be no difference.

Now, if you’ve got an entire world outside your view, you might not want to have all of it loaded at the same time. If it’s just a big scene, and you’re not doing crazy pathfinding algorithms every frame for every ship, you’ll probably be fine keeping everything in at the same time.

If you’re getting bad performance, you might want to look into some kind of object pooling system. BUT! Never do object pooling before you’ve actually identified that your game is running slowly, and understand why that’s happening.

i think you need create a prefab for them and create them in game
disable the renderer not help . even disable the gameobject not help too
you need create enemy and destroy them with destroy() function