Trash organization: Spawning things in a orderly fashion.

With my Enemy Spawner done, enemies are spawning every 5 seconds as long as the Player is alive. That is all fine and dandy however when I look at my scene during all this I see this.

The enemies just pop up in the regular game scene without any organization. Now as a simple game, it may not be the worst, but I like to keep things organized and this wont do.

So I made a Enemy Container object inside my Spawn Manager. Then in my Spawn Manager’s code, the first thing I did was make a GameObject variable to hold that Enemy Container.

Next I needed to make sure the script knew what I was instantiating, so I made a new LOCAL variable called newEnemy to hold the most recent instantiated enemy within it. Which afterwards I would change the PARENT object of the newEnemy into the Enemy Container! Each and every time this code loops, it will do this to the next instantiated enemy.

Now the enemy prefabs go straight into the Enemy Container! Nice and organized.

With this ends the prototyping stage of the game, and it is finally time to give it a well deserved makeover.

See you again soon, with hopefully not more cubes and capsules next time!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store