Game Development Reference
Archetypes and Prefabs
In this chapter, we will be covering the following recipes:
F Construct a leaking pipe prefab
F Adding particles to our prefab
F Adding audio effects to our prefab
F Create a PointLight archetype
F Create a subarchetype from an archetype
As a programmer, one of your tasks is to assist the level designers. This can be done
in a number of ways, but one of the most useful ways is to create what are known as
prefabs and archetypes. By creating templates for objects and actors and only exposing
the variables that a designer will find to be useful, you can make your work, and that of a
designer, far more efficient.
So with that, let's talk about prefabs.
A prefab is a combination of multiple actors into one unit. This allows us to easily manipulate
the properties and visuals of multiple objects on screen at once.
For example, if you wanted to use a torch in a game, you could grab a particle effect for the
fire, another for the smoke, then a static mesh for the torch handle, a sound effect instance
for the crackling sound, and finally a light source for the lighting. Or you could combine all of
these objects into one actor and call it a torch.