© Casey Hardman  2020
C. HardmanGame Programming with Unity and C#https://doi.org/10.1007/978-1-4842-5656-5_5

5. Prefabs

Casey Hardman1 
(1)
West Palm Beach, FL, USA
 

A prefab is a type of asset you’ll store in your project. They act something like a blueprint for objects. You set up a prefab for some kind of object in your game and then add instances of the prefab to your game, in any of your scenes. This connection to the prefab will remain across all the instances, and you can then change the prefab itself to automatically change every instance you’ve placed.

For example, you might make a prefab out of a certain enemy type. You place that kind of enemy throughout your game levels (scenes) possibly hundreds of times. Somewhere down the line, you ...

Get Game Programming with Unity and C#: A Complete Beginner’s Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.