Locking Prefabs
Last updated
Last updated
The main feature of BlackBox is to lock Prefabs, to hide their complexity from the user.
A locked Prefab has two main characteristics:
Only the root GameObject is displayed in the Hierarchy window, no children.
No components visible in the Inspector other than the Transform and BlackBox itself.
This prevents creating overrides on the invisible objects and components by mistake. It is only possible to override the Transform's and the GameObject's base properties (static flags, layers, tags).
Locking a Prefab is done by just 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!
While in Prefab mode, you can unlock the Prefab by just unchecking the Locked property in the Inspector. 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.