Day 18 of my Developer Journey: Spawning the speed boost variable

Objective: Alter the spawn manager to use an array instead of hard coding variable spawns

Now that we have the speed boost powerup finished, lets add it to the list of our spawn manager. We can do this using the array function in Unity, which lets us pre-program a list.

Array for different powerups

Now in the inspector window we can tell the array list how long we want it to be or how many objects it needs to include. In our case, 3 will be required.

Array in the Inspector

Next all we will do is alter the instantiation line of our code to randomly chose between the values 0 and 1, so we now have a 50% chance of spawning either variable.

Random values for instantiating random Powerups

Objective: COMPLETED

--

--