Clean it up! — Using containers in Unity
In the previous article we discussed how to set up a spawn manager, but in it’s current iteration it floods the hierarchy with all of the new enemies as the spawn!
Thankfully, it is easy to have those enemies spawn in another empty gameobject by using the parent/child system.
In the last article, we made a public gameobject variable with the name “enemyContainer”, but did not utilize it.
Inside our spawning coroutine, we are going to assign the local NewEnemy variable to be a child of the enemyContainer variable.
Now our enemies spawn into this container which can be minimized at will!