How to make enemies stop spawning

So I have an infinite zombie spawning game, much like Call of Duty: Zombies, and I have 8 GameObjects around the map that act as spawners spawning 1 enemy every 11 seconds, or eight enemies every 11 seconds if you count all the spawners, but the problem is, within a minute or so, there are so many enemies that the game lags then crashes, so how can I make enemies stop spawning after so many are spawned then start spawning again when that number is reduced by the player killing them, and how many enemies do you recommend exist at once? Thanks in advance!

@kadenatmore
Are you using object pooling for these enemies? If you are, then it’s easy enough to limit the enemies by limiting how many you create in the first place. Object pooling is basically creating a list of the gameobjects you want to pool, and setting them active/inactive as needed. Link to tutorial in case you haven’t seen it yet: Object Pooling - Unity Learn .

If you’re not using object pooling (although I would recommend doing so), you could technically keep a counter of how many enemies are on-screen, stop spawning when they reach a certain point, and restart after they fall below another point, but…that’s probably not a good way to go about it ^^’

Finally, as for how many enemies should exist at once…honestly it depends on how much they’re doing (do they actually go after the player and shoot bullets at them or do they just stand there and kill the player on contact?). Best way to find out is just to test different numbers, I’d say. ^^’