# Locking Prefabs

The main feature of BlackBox is to lock Prefabs, to hide their complexity from the user.

<figure><img src="/files/97PAmYX1232rSw4q91PZ" alt="" width="563"><figcaption><p>The UI of the BlackBox of a locked Prefab</p></figcaption></figure>

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

<figure><img src="/files/SSwBgUUQWcgyyCZ1cmO7" alt=""><figcaption><p>A Prefab made of several objects, locked, appears as one GameObject in the scene</p></figcaption></figure>

Entering Prefab mode reveals the hidden aspects:

<figure><img src="/files/zNSNMDMQKgoPEpeWT86O" alt=""><figcaption><p>The same locked Prefab, now seen "from the inside"</p></figcaption></figure>

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

{% hint style="success" %}
**Tip:** BlackBox has full support for Prefab nesting and Variants. Try nesting locked Prefabs, and see what happens!
{% endhint %}

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tools.continis.io/black-box/main-features/locking-prefabs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
