Creating a “Random Zombie Generator”

Eric Veciana
2 min readMar 28, 2024

In this article, I will discuss how I created a “Random Zombie Generator” instantly as the zombie spawns in my game. This way, there will be a multitude of different zombie variations and I don’t have to do a thing.

I was lucky to get a set of zombie assets that come with a variety of different body and head types that easily fit into each other.

I have a set of heads too.

Then, knowing I have this at my fingertips, I decided to drag all of these into a serialized array within my EnemyAI script.

Then, within my script I created a for loop to first disable all of the outfits and heads so that I wouldn't run into an issue where two heads spawned on top of each other.

Next, since I want these to be generated randomly, I created a local variable that will create a random integer that will set this specific outfit as true.

That is it! This will do all the heavy lifting for me.

Then, I did create a Female Zombie variant. Since it will use the same EnemyAI script, all I need to do is drag the female outfits and heads into the empty serialized field.

--

--