Game Development Reference
In-Depth Information
Importing environment pieces for the modular building method typically leads us into using
Prefabs. Why is this? Take a look at Figure 2-18 . There I've assembled several pieces together to
form a larger corridor section with an inward corner turn. From the Hierarchy panel, as well as the
Project panel, you can see that this larger arrangement is formed from a total of eight smaller mesh
instances, using four different mesh assets. These meshes are included in the topic project files, and
are Corner_Inward , Corner_Outward , Straight_Through , and Single_Section . Together these form a
complete corner section for a corridor.
Figure 2-18. Building common environment modules from meshes
Now, assembling these smaller pieces together into larger areas like this works well enough, at least
for one corner section or one T-section, but overall it takes time and patience to build. However, a
scene will typically have many corridors with turns and corners and T-sections, as well as other similar
architectural configurations that repeat themselves over and over again. Without using Prefabs, we'd
have to duplicate (copy/paste) the different arrangements where required, selecting all pieces that
compose a section, and then duplicate it for reuse elsewhere in the environment. By using Prefabs,
we can dramatically reduce our workload in this context. In the case of a corner section, we can build
just one corner section, make it a Prefab asset, and then reuse that asset for every repetition, as
though it were a separate mesh—just like a rubber stamp can be reused to print many instances of
the same pattern. This can make Prefabs an invaluable tool for making modular environments.
 
Search WWH ::




Custom Search