Western Shooter Devblog #6 | Spawn System without the Clutter in Unity

Building this spawn system will take a combination of everything we’ve learned so far and applying new methods we haven’t used before! The goal for our spawn system is to tackle three basic features: Modularity of Use, Customizable Enemy Spawn Settings, and Randomized Spawn Points. We’ll be tackling each of these features throughout the next couple devblogs! But before we get to that, we need to make a better environment for our Spawn System to work around.

That’s better! Let’s call it Cube Town, in which Cubert is the… Sherriff? We can figure out the backstory later, let’s get to coding!

We need to make sure that our system not only works spawning the enemies we have now, but that it will work spawning the enemies we might have in the future. And that is what modularity will do for us.

An easy first step is establishing our spawn points in our game, so that we can reference these later when we begin Instantiating our enemies there.

I want our enemies to appear from behind the first set of buildings and then gradually appear closer and closer to the player if they fail to stop them. So, I actually want two spawn points that enemies can spawn from as to not make the game too predictable.

We’ll serialize their transforms so that no matter where we put them in our scene, as long as we have them attached in the inspector, we can spawn an enemy on them!

This method is not only key in keeping our spawn system modular, but is really important for reducing clutter in our hierarchy once we start Instantiating enemies from our Spawn Manager. With that said, it’s vital that we child our spawn points to the Spawn Manager because anything that we instantiate on the transform of our spawn point will then become childed to that spawn point. Doing this will keep all our enemies in their respective folders from where the spawned from and avoid a massive amount of enemy prefabs completely cluttering the hierarchy!

Next devblog we’ll be able to see this in action once we begin using Coroutines to build our spawn system!

Passionate self taught game developer excited to learn and share everything I can about game development!