Creating and Using Prefabs

Prefab libraries allow you to easily store pieces from your levels that can be used over and over. Examples of useful prefabs include hallways, light fixtures, unique objects (vehicles, etc), and furniture.

First, you need to create the library.

In the Prefab Factory dialog, click on the Add Library button. The Edit Library dialog will appear. Enter the name of the library and a brief description. Press Enter to create the library.

Now, you have an empty library and a map with several objects you'd like to add as prefabs.

To add an object to the prefab library, find the object in your map and select all of it and press Ctrl+R.

The Create Prefab dialog will appear allowing you to define the name and description of the prefab, as well as which library it will be placed into. Repeat this process for as many objects as you'd like.

Placing Prefabs
Placing the objects you make is just as simple.

In the New Objects toolbar, select the library from the Categories list, select the object from the Objects list, and press the Insert original prefab button. The object will be inserted in your map, centered in the 2D views. For more information on placing prefabs, see Creating Solids.

Return to the Valve Hammer Editor 3.x User's Guide