Prefabs Basics and Variants

A Unity prefab stores a configured GameObject, its components, property values, and child objects as a reusable project asset. Instances placed in scenes remain connected to that asset, so a change to the prefab can update every connected instance.

Create a reusable prefab

Clean the scene object, save it as a prefab asset, place instances from the Project window, and review overrides before applying broad changes.

  1. Build and test the complete object hierarchy in a scene.
  2. Drag its root GameObject into a project-owned prefab folder.
  3. Place a new instance, change one property, and inspect the Overrides menu.
VRChat prefabs

The Worlds SDK includes example prefabs for common systems such as the VRCWorld setup, mirrors, chairs, avatar pedestals, portals, video players, and pens. Treat them as working examples, preserve required components and references, and run a local VRChat test after customization.

Prefab Terms

Term Meaning
Prefab asset The reusable template stored in the Project window.
Prefab instance A connected copy of that asset in a scene or another prefab.
Prefab Mode An isolated editing view for a prefab asset.
Override A difference stored on an instance while it remains linked to the prefab asset.
Prefab variant A prefab that inherits from a base prefab and stores a reusable set of overrides.
Nested prefab A prefab instance stored inside another prefab.
Unpacked object Ordinary scene GameObjects that no longer use the unpacked prefab connection.

1. Prepare the Scene Object

Before creating the prefab:

  • give the root and child objects descriptive names
  • confirm the parent-child hierarchy
  • remove temporary test objects
  • inspect missing component fields
  • assign project assets from stable locations
  • test colliders, renderers, audio, animations, and interactions

A prefab preserves the hierarchy and serialized references it is given. Cleaning the object first prevents temporary content from becoming part of every new instance.

2. Create the Prefab Asset

  1. Create a project-owned folder such as Assets/World/Prefabs.
  2. Select the root GameObject in the Hierarchy.
  3. Drag it into that folder in the Project window.
  4. Rename the prefab asset if needed.
  5. Drag the prefab asset into the scene to create a new instance.
  6. Verify that the new instance behaves like the original.

The prefab asset is the template. Deleting a scene instance does not delete the asset; deleting the asset removes the template required by its connected instances.

3. Edit in Prefab Mode

Open a prefab asset by double-clicking it in the Project window or using Open from a connected instance.

Prefab Mode is appropriate when a change should become part of the prefab asset:

  • adding a required child object
  • correcting a collider
  • assigning the default material
  • fixing a missing component reference
  • changing a default component value

Save the prefab and return to the scene. Connected instances receive the asset changes unless an instance override takes precedence for the same property.

4. Understand Instance Overrides

An override keeps one instance different without breaking its prefab connection. Unity supports override types including:

  • modified property values
  • added components
  • removed components
  • added child GameObjects

The instance's root Transform position and rotation are expected to differ in a scene and are not treated like ordinary default-property overrides. This allows many instances to be placed in different locations.

Select the outermost prefab instance and open Overrides in the Inspector to review its differences.

Decision Use it when
Keep the override Only this instance should differ.
Apply the change The base prefab should use the new value or structure.
Revert the change The instance should return to the prefab's value or structure.
Create a variant The same collection of differences will be reused.

Review the target named in Unity's override controls. Applying a change modifies an asset and can affect other scenes and prefab instances.

5. Apply or Revert One Change

For a focused correction:

  1. Select the prefab instance.
  2. Open Overrides.
  3. Expand the changed component or object.
  4. Confirm the displayed difference.
  5. Apply that specific change to the intended prefab asset, or revert it.
  6. Inspect another instance to confirm the result.

Avoid Apply All until every listed override is understood. A broad apply can promote scene-specific references, temporary children, or experimental component values into the shared asset.

6. Create a Prefab Variant

A variant inherits from a base prefab and stores a named, reusable set of differences.

To create one:

  1. Select the base prefab in the Project window.
  2. Right-click and select Create > Prefab Variant.
  3. Give the variant a name that explains its purpose.
  4. Open the variant in Prefab Mode.
  5. Add the intended overrides.
  6. Place and test an instance of the variant.

You can also drag an overridden prefab instance from the Hierarchy into the Project window and choose Prefab Variant in Unity's dialog. The instance overrides become part of the new variant.

Examples:

Base prefab Variant
PFB_Chair PFB_Chair_Red with a different material.
PFB_WallSign PFB_WallSign_Exit with different display content.
PFB_LightFixture PFB_LightFixture_Blue with different light and emission values.
PFB_PickupDisplay A themed version with additional decoration.

Changes inherited from the base continue to reach the variant unless a variant override replaces the same property.

Applying Overrides From a Variant

Inside a variant, its differences are supposed to remain overrides on the base. Unity warns that applying those overrides changes the base prefab itself.

Before applying from a variant:

  1. Read the target shown in the Overrides panel.
  2. Confirm whether the control says it will apply to the base.
  3. Check whether every base instance should receive the change.
  4. Cancel if the property is meant to define only the variant.

For example, applying a red-material override from PFB_Chair_Red to PFB_Chair would also make the base chair red.

7. Use Nested Prefabs

A nested prefab is a prefab instance inside another prefab. The nested instance keeps its own connection to its own asset.

Example:

PFB_InformationBooth
├── BoothMesh
├── PFB_WallSign
├── PFB_InteractionButton
└── PFB_AudioSource

Editing PFB_WallSign can update its nested instances without requiring the information booth to duplicate the sign's complete hierarchy.

To add one in Prefab Mode:

  1. Open the outer prefab.
  2. Drag another prefab asset from the Project window into its Hierarchy.
  3. Position and configure the nested instance.
  4. Save the outer prefab.

Nested prefab instances can also hold their own overrides. Review which prefab level owns a change before applying it.

8. Unpack Only When the Link Should End

Right-click a prefab instance in the Hierarchy and select Unpack Prefab to turn that prefab level into regular GameObjects. Its current overrides remain as ordinary values, and the original prefab asset is not deleted.

Unity provides two related actions:

Action Result
Unpack Prefab Removes the selected prefab link while nested prefab instances retain their own links.
Unpack Prefab Completely Removes the selected link and all prefab links revealed beneath it.

Unpacking is appropriate only when the object should stop receiving changes from that prefab relationship. It is not required for ordinary property overrides.

Make a backup before unpacking a large or complex hierarchy. Reconnecting the resulting loose objects to the original prefab is not the same as undoing the operation after other edits have been made.

VRChat SDK Prefabs

VRChat documents example prefabs supplied with the Worlds SDK, including:

  • VRCWorld
  • VRCMirror
  • VRCChair
  • VRCAvatarPedestal
  • VRCPortalMarker
  • synchronized video players
  • Simple Pen System
  • Udon variable-sync examples

The VRCWorld prefab contains the scene descriptor and related world setup used by VRChat. VRChat's Udon example documentation lists the current asset under Packages/com.vrchat.worlds/Samples/VRCPrefabs/VRCWorld.prefab.

Package contents can change when the SDK is updated. Keep project-specific assets and backups outside package-owned folders. After modifying or unpacking an SDK example:

  1. inspect every VRChat and Udon component
  2. check serialized object references
  3. run ClientSim when it supports the behavior being tested
  4. use Build & Test Your World for the VRChat client result

Prefab Review Checklist

Check Confirm
Root The prefab has one clear root and a readable hierarchy.
References Required materials, scripts, objects, and Udon programs are assigned.
Overrides Each instance override is intentional.
Apply target An Apply action points to the prefab asset you intend to change.
Variants Reusable variations inherit from a suitable base.
Nesting Each nested prefab has a clear responsibility.
Unpacking The prefab link is removed only when that is the intended outcome.
Testing Changes have been tested in every affected scene and VRChat platform.

Troubleshooting

Changing the prefab did not update one instance.

Select that instance and inspect its Overrides list. A property override on the instance takes precedence over the prefab asset's value for that property. Revert it only if the instance should return to the shared default.

I applied an instance change and many scenes changed.

The change was applied to a shared prefab asset. Undo immediately if Unity still has the operation in its history, or restore the prefab asset from backup or version control, then inspect affected instances.

The variant change appeared on the base prefab.

An override was applied from the variant to its base. Restore the base value, then keep the variation as an override inside the variant instead of applying it upward.

I cannot remove or reparent an inherited child in a variant.

Unity does not allow a variant to remove or reparent GameObjects inherited from its base. You can deactivate an inherited object with a property override, or redesign the base prefab so the variation is supported cleanly.

An unpacked object no longer receives prefab fixes.

Unpacking intentionally removed that prefab connection. Undo the unpack if possible, replace the loose hierarchy with a fresh prefab instance, or maintain the object separately.

A customized VRChat prefab stopped working.

Compare it with a fresh SDK example and inspect missing VRChat components, Udon programs, event targets, and object references. Test the repaired setup in the VRChat client before replacing other instances.

Continue Learning

Official References

Next Step

Create a small reusable prop prefab, place two instances, add one property override, and use the Overrides panel to decide whether that difference belongs on the instance, the base prefab, or a new variant.

Related Navigation