Using prefabs

In the previous section, you created a sphere to simulate a blood droplet. You also created a red material and applied it to your sphere. In the game, we might want to simulate a great battle and have multiple blood droplets visible at once. In Unity, we can make as many copies of our master as we want. For example, let's assume we have 100 spheres, all copied from our master. What happens when we want to alter them, perhaps changing the size or material? It would be a laborious task to edit each one. 

An alternative is to use a prefab. In Unity, a prefab is an asset type that serves as a shell for a GameObject along with properties and components. The sphere we created is a GameObject, and, as you can see in the following screenshot, ...

Get Getting Started with Unity 2018 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.