The ZombieSpawner is a simple script that randomly instantiates a zombie at one of the three ZombieSpawnPoint points every few seconds. Take the following steps to set it up:
- Create an empty GameObject named SpawnController and position it anywhere in the scene. I generally like to put controller scripts at 0,0,0, but since our player will be anchored to that location, feel free to place it somewhere else. Try using 0,0,-2 for this example.
- Add a new script to the SpawnController and name it ZombieSpawner.
- Move the script to our Scripts folder.
- Double-click the script to launch it in your editor. Edit the script to match the following:
using System.Collections;using System.Collections.Generic;using UnityEngine;public ...