Prefabs are groups of objects that can be placed in the level as instances. An instance is an object that is an exact copy of every other object of the same type.
Altering one prefab universally applies the changes to each instance of the prefab object. Any alterations need to be saved to the Prefab library to ensure they are correctly propagated across the entire game.
The Prefabs Library is a part of The DataBase View. It lists all the Prefab objects that are available for a specific level.
An example of two instances of a prefab.
Prefabs now support Flowgraph logic, so make sure you check out the Prefab Communication tutorial for more information.
Open the Database View by going to the main menu: View -> Open View Pane -> Database View.
Now, enter the Prefabs Library by clicking its tab at the top of the window.
To create a new library, click the Add Library button and type in a new library name.
Make sure that you click Save Library once you're done.
In order to load an existing prefab library, click the Load Library button and select a library by pressing the Open.
First, place several objects in the level that you wish to change to a prefab. Select all the objects that you require. Next, on the Prefabs menu, click Make From Selection.
Now, fill in a Group and Name for the new prefab. The prefab will be created in the currently selected library.
The prefab has now been created and is ready to be used in the level.
There are several important parameters when working with prefabs.
Parameter | Description |
---|---|
Prefab Name | The name of the prefab, taken from the prefab library. Click on the < icon to open the prefab in Database View. |
Object list | A list of all the objects within the prefab, alongside their object type. |
SubObject info | For the current object, this is selected within the prefab. |
Name | The name of the SubObject. |
Class | The main of the SubObject (the main class type - for example, entity, brush, ambient volume, light). |
Type | The type of the SubObject (the sub type - for example, destroyable object, constraint, AI grunt). |
Update Prefab | Obsolete (this is now done automatically) - Manually updates the selected prefab with any current edits. |
Reload Prefab | Obsolete - Reloads the current prefab from the last saved version in the Prefab Library. |
Pick and Attach | Allows you to add a new object to the selected prefab, by clicking on it. |
Remove Object | Allows you to remove an object from the selected prefab; select the object from the Objects List, and then click the Remove Object button. |
Extract Object | Extracts a clone of a single object from the prefab, without altering or removing anything from the prefab object itself. |
Extract All | Extracts all the objects from the prefab, without altering the Prefab Library. |
Open | Opens the prefab group, allowing you to edit and manipulate objects within it. |
Close | Closes the prefab so that internal objects cannot be individually edited. |
Open All | Open all instances of this prefab inside the level. |
Close All | Close all instances of this prefab inside the level. |