Sometimes it is necessary to create variations of a prefab. For example, if you have a button and you need a few variations with a different color or icon. This can be done easily with Nested Prefabs by following the next steps:
1. Create any regular prefab to use as a base prefab. In this example, we will be using a simple button.
2. To create a variation of the prefab you can add a new empty parent for the prefab. This new parent can then be saved as a separate prefab (“Button-Variation”). As a result, you will have a new prefab with the base “Button” as a nested prefab, so any changes made to the base button are also applied to the variation prefab.
3. Now, you can add a Prefab Overrides component to the nested prefab (“Button”). In the component, it is possible to override properties to create a variation of the original base prefab. In the example, the color of the button is changed to green. These overridden properties will not be applied to the base prefab and will only be saved in the prefab variation.
4. Multiple variations can be created by either repeating these steps or by saving the prefab variation (“Button-Variation”) as a new prefab.