unity3d Prefabs Creating prefabs

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

To create a prefab, drag a game object from the scene hierarchy into the Assets folder or subfolder:

enter image description here

enter image description here

enter image description here

The game object name turns blue, indicating it is connected to a prefab.
Now this object is a prefab instance, just like an object instance of a class.

A prefab can be deleted after instantiation. In that case the name of the game object previously connected to it turns red:

enter image description here

Prefab inspector

If you select a prefab in the hierarchy view you'll notice that it's inspector slightly differs from an ordinary game object:

enter image description here

vs

enter image description here

Bold properties mean that their values differ from the prefab values. You can change any property of an instantiated prefab without affecting original prefab values. When a value is changed in a prefab instance, it turns bold and any subsequent changes of the same value in the prefab will not be reflected in the changed instance.

You can revert to original prefab values by clicking Revert button, which will also have value changes reflect in the instance. Additionally, to revert an individual value, you can right click it and press Revert Value to Prefab. To revert a component, right click it and press Revert to Prefab.

Clicking the Apply button overwrites prefab property values with the current game object property values. There is no "Undo" button or confirm dialog, so handle this button with care.

Select button highlights connected prefab in project's folder structure.



Got any unity3d Question?