Version: Unity 6.2 (6000.2)
Language : English
Override prefab instances
Revert a prefab instance to a GameObject

Removing unused override data

An override on a prefabAn asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info
See in Glossary
might become unused in the following situations:

  • The override’s target object is invalid.
  • The override’s property path is unknown. This might happen if you delete a public field definition or rename it. To preserve overrides when renaming fields, you can use FormerlySerializedAsAttribute.

Unity stores the unused override data in the sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
file, which means that if you restore the deleted script or field definition, Unity reapplies the override data. Unity doesn’t automatically clean up unused data because you might have moved the object or property the data refers to temporarily or in error. It’s best practice to clean up unused override data to ensure that scene files only contain relevant data, which makes version controlA system for managing file changes. You can use Unity in conjunction with most common version control tools, including Perforce, Git, Mercurial and PlasticSCM. More info
See in Glossary
and collaboration easier.

Remove unused overrides

To check for and remove unused overrides, perform the following steps:

  1. In the prefab instance InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    , select Overrides.
  2. Select Unused overrides. If the prefab instance doesn’t have any unused overrides, this section is unavailable.
  3. The Unused overrides panel displays a list of the unused overrides. Select Remove to remove them.

Unity writes details of the removed overrides to the Editor log.

Unused overrides panel, displaying unused overrides on the selected prefab.
Unused overrides panel, displaying unused overrides on the selected prefab.

You can also remove unused overrides from the Hierarchy:

  • Right-click on a prefab instance and select Prefab > Remove Unused Overrides.
  • Right-click on the scene name and select Prefab > Remove Unused Overrides to remove all unused overrides in the entire scene.

A dialog appears to confirm the removal of the overrides.

Additional resources

Override prefab instances
Revert a prefab instance to a GameObject