Spawning hundred enemies on iPhone

In one level I have 120 enemies moving from the right side of the screen to the left in rows. The goal is to kill all before they reach the left side. My game is 2d and makes use of Brady's SpriteManager 2. I have up to 15 enemies on the screen at a time. I have tried following solutions for making this run smoothly:

  1. Instantiating 10-15 enemies every time "one row" is cleared. This is not a good solution as the game freezes shortly as the enemies are being instantiated.

  2. Instantiating all enemies at the beginning of the level, and deactivating them all until they are needed. Same problem as in solution 1. When 15 enemies is activated, the game freezes.

  3. Instantiating all enemies at the beginning of the level, and disable the renderer on every game object until they are needed. This works okay, but it seems like it is not running completely smoothly.

Do you have a better solution or is this the way to go?

You can also try to replace the sprite manager with something more light-weight of your own. I have nothing against Brady's SpriteManager, it's in fact a nice tool, but it is a bit overkill for some uses, especially on iOS devices.

Try optimizing the causes, not the symptoms: How complex is a single enemy? Especially draw calls, maybe also number of sub-objects, scripts, components, etc. Reduce it to the bare minimum.

I'd go with option 3 with a small change. I'd hold them offscreen until needed instead of enabling/disabling the renderer. Also, keep in mind that you have 120 objects with the same number of scripts running. Check your Update() in the enemies script and try to optimize it. If you have unity pro you could run a copy of your project in pro and check the profiler for anything unusual.

Iphone has many enemies including all of the androids and droids blackberrys and sprints palm pre and more