Locking a Prefab

The main feature of BlackBox is to enable locking Prefabs.

A locked Prefab has two main characteristics:

  • The hierarchy displays only the root GameObject, and no children.

  • No components are visible in the Inspector, except Transform and BlackBox.

For the invisible objects, it becomes impossible to create overrides on them. It is only possible to create overrides on the Transform and on the GameObject's base properties (static flags, layers, tags, ...).

How to lock a Prefab

Locking a Prefab is done just by adding the BlackBox component to it.

You can either:

  • Open the Prefab in Prefab mode, and add the BlackBox component.

  • Alternatively, you can add the BlackBox component to a GameObject in the scene and then turn it into a Prefab by dragging it into the Project view.

Both cases lead to the same result: the Prefab is now locked for edits.

Entering Prefab mode reveals the hidden aspects:

In Prefab mode, all children and root components become visible again, and editable.

Tip: BlackBox has full support for Prefab nesting and Variants. Try nesting locked Prefabs, and see what happens!

Temporarily unlocking a Prefab

While in Prefab mode, one can unlock the Prefab by just unchecking the Locked property in the Inspector. When doing so, the Prefab now shows again all its children and components when seen outside of Prefab mode, but the BlackBox component is still there so it can be used at a later stage.

Last updated