top of page
Search

[02/04/2021] Random Spawn Location and Countdown

  • Writer: Daniel Henshaw
    Daniel Henshaw
  • Apr 1, 2021
  • 1 min read

Updated: May 19, 2021

To make my random car spawner I created a folder called "Resources" with another folder called "Cars" located inside. I did this because it allows me to automatically gather all of my car Prefabs into a list of game objects. I did this so it wouldn't have to manually select all of the cars. It also makes it easier in the future to add more cars.


I then created a static GameObject variable inside my GameManager script called "Player". This makes it so it is really easy to swap the player car which is good because we have plans to create a garage with a car picker.


The SpawnManager script also has a list of 4 spawn points. When the level is started the SpawnManager script adds the player car and randomly pics 3 other cars that are different. This list is put into a random order and then the cars are instantiated to their corresponding spawn point.


When the cars are spawned they are unable to move as a boolean called "isCutscene" is set to true. As soon as the countdown gets to 0 this boolean is set to true allowing the cars to drive.


Demo:


Trello:


 
 
 

Comments


bottom of page