2D Shooter: Cleaning up the Spawn Manager

Sabrina Windsor
2 min readJun 3, 2021

With the Spawn Manager set up, if we keep letting enemies instantiate without destroying them they will eventually take up a lot of room in the hierarchy. We’ll want to minimize the clutter if that happens.

To do this, we’ll want to create an empty object within the SpawnManager object in the hierarchy. Name it “Enemy Container”.

Like we did for the enemy prefab, we also want to make a variable for the container in the script where we can drag the container object to the variable box in the inspector. This gives us access to turn it into a parent.

Now in order to manipulate the instantiations we need to be able to store the information. We do this by assigning the line of code to another variable.

Now we can tell the new enemy to be sorted into the enemy container:

And that’s all that’s to it!

--

--

Sabrina Windsor

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!