Game Development Reference
In-Depth Information
Spawning the horde
Now that we have our Goblin enemy, we need to be able to randomly drop some into the
battle. For this, we need to set up some spawning points (because we don't want them to
appear just anywhere) and a script to manage them.
So first create a new empty game object in the scene and call it SpawnPoints . This is
just a container to keep the spawn points all together. Next, create nine more empty game
objects, make them children of the SpawnPoints game object, and then name them
Spawn1 , Spawn2 , and so on, as shown in the following screenshot:
Now, position each Goblin in the scene where you want it to appear.
Tip
While doing this, I find that adding the prefab manually to each spawn point and then pos-
itioning it makes it a lot easier to find the right spot. However, remember that the order in
which you add them to the scene is important as it affects what order they are drawn in.
You can also alternatively add an editor script to the object to make it easy to use in an ed-
itor. See Chapter 10 , The Battle Begins , for more information on editor scripts.
After a bit of tinkering, I ended up with the following (I also added a hero character for ef-
fect) screenshot:
Search WWH ::




Custom Search