‎ ‎
On the Asset Store
BlackBox
BlackBox
  • Intro
  • Changelog
  • Troubleshooting
  • Main features
    • Locking Prefabs
      • Temp Unlock
      • Extra locking options
    • Reveal
      • Properties
        • UnityEvents as buttons
      • Entire components
      • Object references
      • Methods
      • Reveal lists
    • Disable Apply
  • Integrations
    • Odin Inspector
  • Other
    • Selection type
    • Project Settings
Powered by GitBook
On this page
  • How to lock a Prefab
  • Unlocking a Prefab
  1. Main features

Locking Prefabs

Last updated 5 months ago

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).

How to lock a Prefab

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!

Unlocking a Prefab

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.

The UI of the BlackBox of a locked Prefab
A Prefab made of several objects, locked, appears as one GameObject in the scene
The same locked Prefab, now seen "from the inside"