Sandbox WorkingWithPrefabs

From CryWiki

Sandbox WorkingWithPrefabs
Jump to: navigation, search

Contents

Working With Prefabs

Overview

Prefabs are groups of objects which can be placed in your level as instances. An instance is an object which is an exact copy of every other object of the same type. When you edit one instance of an object, every other instance that exists in your game will change, either instantly or when the instance is reloaded.

Index

What are prefabs?

A prefab is a predefined group of objects. Every time you place down a prefab, each instance is precisely the same in every way. Altering a prefab will make it change everywhere it has been placed. Any alterations need to be saved to the prefab library to ensure they are correctly propagated across your entire game.

An example of a prefab

Image:Sandbox_WorkingWithPrefabs_image001.jpg


The Prefabs Library

Open up the Database View by going to the main menu View > Open View Pane > Database View

Now, enter the Prefabs Library by left clicking its tab at the top of the window.

Image:Sandbox_WorkingWithPrefabs_image002.jpg


Creating a new Library

To create a new library, click the Add Library button…

Image:Sandbox_WorkingWithPrefabs_image003.jpg

…and type in a new library name.

Image:Sandbox_WorkingWithPrefabs_image004.jpg

Make sure you click the Save Library, once you’re done.

Loading a prefab library

Next, lets load up an existing prefab library. Go to the Load Library button.

Image:Sandbox_WorkingWithPrefabs_image005.jpg

Now, select a library, and press the open button. For the purposes of this tutorial, load buildings.xml

Image:Sandbox_WorkingWithPrefabs_image006.jpg

Now, you can go into the prefabs library and find Village_House_1. Left click, drag and drop the prefab into your level.

Image:Sandbox_WorkingWithPrefabs_image007.jpg

Creating a new prefab

Firstly, place the objects in your level that you wish to change into a prefab. Select all the objects you require

Image:Sandbox_WorkingWithPrefabs_image008.jpg

Next, go up to the Prefabs menu, and select Make From Selection
Image:Sandbox_WorkingWithPrefabs_image009.jpg

Now, fill in a Group and Name for your new prefab. The prefab will be created in your currently selected library.

Image:Sandbox_WorkingWithPrefabs_image010.jpg

Now your prefab has been created and is ready to use in your level.

Prefab Object Properties

Image:Sandbox_WorkingWithPrefabs_image011.jpg

Prefab Params

Merge Static Geometry Not used.

Prefab Parameters

Prefab name
The name of the prefab, taken from the prefab library.

Object list
A list of all objects within the prefab, alongside their object type.

Subobject info
For the current object 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
Updates the selected prefab manually with any current edits.

Reload Prefab
Reloads the current prefab from the last saved version in the prefab library.

Pick and Attach
Allows you to add an new object to the selected prefab, by clicking on it
Image:Sandbox_WorkingWithPrefabs_image012.jpg

Image:Sandbox_WorkingWithPrefabs_image013.jpg

Remove Object
Allows you to remove an object from the selected prefab. Select the object from the Objects List, then click the Remove Object button

Image:Sandbox_WorkingWithPrefabs_image014.jpg


Extract Object
Extracts a clone of a single object from the prefab without altering or removing anything from the prefab object itself.

Image:Sandbox_WorkingWithPrefabs_image015.jpg

Extract All
Extracts all 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 internal objects cannot be individually edited

See Also

Personal tools