Course contentsShow
← Unity Game Development
Lesson 38 of 8281. Unity FoundationsFree lesson

Streamlining Asset Workflows with Prefab Variants

You will create and manage prefab variants to maintain consistent asset properties while allowing for unique overrides across different game environments.

In this lesson, you will learn how to use Prefab Variants to create unique versions of objects while keeping them linked to a shared "master" design.

The Problem: Managing Duplicates

Previously, we learned that we can override properties on a standard Prefab instance. However, if you have twenty different versions of a "Enemy" prefab—each with different colors or health values—manually tracking those overrides across your project becomes a nightmare. If you decide to change the enemy’s base movement script, you would have to update every single instance individually.

The Solution: Prefab Variants

A Prefab Variant acts as a child of an original (Base) Prefab. It inherits every property, component, and child object from the Base. The magic happens because a Variant is its own independent file in your Project window, yet it stays connected to the Base.

  • Inheritance: If you change the Base Prefab (e.g., swapping a mesh or updating a script), all of its Variants automatically receive that update.
  • Customization: You can change specific properties on the Variant (like a different Sprite color or a higher Health value), and those changes are saved as part of the Variant’s unique identity, not as a messy override.

How to Create One

  1. Drag your Base Prefab into the scene.
  2. Right-click the instance in the Hierarchy.
  3. Select Prefab > Create Variant.
  4. Name your new Variant (e.g., Orc_Boss based on the Orc_Grunt Base).

Now, if you adjust the Orc_Boss scale or color in the Inspector, the Orc_Grunt remains untouched. But, if you add a new AudioSource component to the Orc_Grunt Base Prefab, the Orc_Boss will instantly inherit that audio component as well.

This workflow allows you to maintain "families" of objects. You keep your core logic and structure consistent at the base level, while allowing for specialized versions that are easy to manage, update, and organize.

Key Takeaway: Prefab Variants allow you to establish a shared foundation for your assets while delegating unique properties to specialized files, ensuring that global updates propagate automatically without breaking your custom variations.