fbpx
Working with Prefab Variants2019-03-24T03:04:00+00:00

Guides

Be an expert with our advanced guides and build beautiful high-quality games.
Get a head start and receive knowledge directly to your inbox:

Expert Workflows

“I am constantly updating and extending this guide. Let me know in the comments what you would like to know about!”
– Max

Working with Prefab Variants

What are prefab variants?

Prefab variants are variations of a prefab that are saved as a separate prefab asset. They share their data with the original prefab asset but have a few overridden properties that differ from the original prefab.

For example, you can create a variant of a character but with different colors. The variant will then share the same character data, properties, and components. And if you update the original character, then the character variant will be updated as well. Except for the color, that property will be unique for the variant.

How to create a prefab variant?

Right-click on a prefab asset and choose ‘Create > Prefab Variant’ to create a new prefab variant of that prefab.

Prefab variants automatically override all modified properties and save them to the prefab variant asset instead of applying them to the original prefab.

Where is my data stored and what do I edit?

All the data of your prefab variant is still stored in the original prefab asset. The prefab variant only stores the values of properties, components, or objects that have been overridden.

If you want to make a modification that affects all prefabs, nested prefabs, and prefab variants of that prefab then you should modify the original prefab asset. If you only want to modify this prefab variant, then you should edit this prefab variant directly.

How to edit prefab variants

Prefab variants should be edited like normal prefabs by opening them in ‘prefab mode’. By default, all modified properties are saved as overridden properties. But, if you want, you can apply the modified properties to the original prefab.

To apply the values to the original prefab, click the ‘Overrides’ button in the Inspector. Then, click ‘Apply All’ to apply the values to the original prefab and no longer override them.

Expert Workflows

Now that you know all the fundamentals of nested prefabs you can continue by making yourself familiar with the Best Practices for experts. Or take another look at how to Override Properties in the previous article.

Get a head start

Become an expert by reading more of our advanced guides and build beautiful high-quality games. Get a head start and receive knowledge directly to your inbox:

Your thoughts

Let us know what you think. If you have any feedback, ideas, or just something awesome to say. We would love to start a conversation with you: