Loading lessons...
Prefab Workflows
Prefab Workflows
A Prefab is a reusable GameObject asset stored in your Project assets. It acts as a template or blueprint from which you can create identical GameObject instances in your scenes.
Creating and Editing Prefabs
To create a Prefab, construct and configure a GameObject in your Hierarchy, then drag the GameObject from the Hierarchy into the Project Window. The GameObject in the Hierarchy turns blue, indicating it is now an instance of a Prefab.
To edit a Prefab, double-click the Prefab asset in the Project Window to enter Prefab Mode, make your changes, and save.
Instance Overrides
You can modify individual Prefab instances in a scene. Modifying a property on an instance creates an Instance Override (the overridden property text turns bold in the Inspector). Overridden properties do not update if you change the parent Prefab asset. You can apply overrides back to the main Prefab asset by clicking Overrides -> Apply All in the Inspector.
Prefab Variants
A Prefab Variant is a Prefab that inherits properties from a base Prefab. For example, you can have a base "Enemy" Prefab, and create variants like "Red Enemy" or "Boss Enemy". Changes to the base "Enemy" Prefab flow down to all variants, but variant-specific overrides remain intact.
Unpacking Prefab Instances
If you want to completely break the connection between a Prefab instance in your scene and its template asset, right-click the instance and choose Prefab -> Unpack. The object returns to a normal GameObject with no Prefab link.
TL;DR
- A Prefab is a reusable GameObject template stored as an asset.
- Changing a Prefab asset updates all of its instances in the project.
- Overrides let you customize specific instances.
- Prefab Variants inherit from a base Prefab but support overrides.
- Unpacking a Prefab instance disconnects it from its source asset.