O'Reilly logo

Virtual Reality Blueprints by John Williamson, Charles Palmer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ZombieSpawner script

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:

  1. 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.
  2. Add a new script to the SpawnController and name it ZombieSpawner.
  3. Move the script to our Scripts folder.
  4. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required