-
Prefabs in Unity are preconfigured game objects
-
that you create in the scene
-
and store in the project.
-
They can then be instantiated or cloned,
-
meaning to create an instance of them
-
during the game.
-
They have all manner of uses and are a key part
-
of development in Unity.
-
They are used for everything from rockets
-
to enemies, to procedural levels.
-
To make a prefab simply create your game object
-
in it's desired configuration in your scene,
-
from whatever components you need,
-
and then drag it to the project panel
-
to save it as a prefab.
-
It can then be deleted from the scene.
-
To edit a prefab you can either select it in the project,
-
and adjust properties in the inspector.
-
Or drag an instance of it back in to the scene,
-
edit it in the inspector,
-
and then press the apply button at the top.
-
This saves changes back in to the prefab
-
and you can then remove the instance from the scene
-
yet again.
-
Also, if you have many instances of a prefab,
-
and you make edits to one of them,
-
and decide you would like others to be the same
-
you can hit apply.
-
The other instances will inherit this update
-
from the prefab's settings.
-
Likewise if you make a change to
-
one of your instances
-
and you decide you don't like it anymore
-
you can revert to the settings of the prefab
-
by clicking the revert button at the top.