Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Prefab and Object Manager

v4.0

Overview

The Prefab And Object Manager is a component you can attach to any object in your scene, which makes it very easy to create groups of Game Objects and Prefabs -- individually or mixed together -- which you can turn on in your project with a single line of code.

For static game objects, such as furniture in a room, or props on a table, this script is all you need.

For characters or other objects using the wardrobe and/or blend shapes, you may want to also add the Wardrobe Prefab Manager (required for rigging objects added to the scene), and the Blend Shapes Manager (required for working with mesh morphing).

Setup

Select the parent of the object -- often the "place" where objects will be related to, or for wardrobe, the character. In the inspector, click "Add Component", and search for Prefab And Object Manager. Add it!

Inspector

There are three tabs in the Inspector.

This is where you create and manage your Prefab Groups. Type in the "Type", and the sort order will update. Name the "Group Name" something unique, as this is used with scripting.

At edit time, use the "Activate" and "Deactivate" buttons to see the results.

See full details on the Prefab Groups page.

Once you have defined Group Types (in the Prefab Groups tab), they will display here, where you can change the type name for all of the Prefab Groups at once.

Toggle "Show Help Boxes" on to reveal Inspector boxes with additional context, beyond the tool tips.

"Show Full Inspector" will show, at the bottom, the full Inspector for the script. This may be useful for debugging, but data should not be manipulated via the full inspector.

With "Instantiate Prefabs when Added to Group" on, prefabs that are added to a Prefab Group will be instantiated in the scene, helping you visualize what the full group looks like.

"Only one group active per type" will ensure that, for any named Group Type, there will only be one Prefab Group active at a time. This means that if you call Activate(groupName), any active group of that type will automatically deactivate first. Essentially this allows you to switch groups with a single line of code.

"Unpack Prefabs when Instantiated" is on by defualt, and is suggested to remain on. If true, prefabs will be unpacked. If they are not unpacked, certain features, like deleting objects, may throw errors.

Last updated