# Prefabs

### **Prefab Basis**

**Prefab** (Pre Defined GameObject) that is an ordinary game object with all its components and properties configured in them, stored on the hard disk as an asset. In fact, this is a template that we can reuse in scenes.

If you want to place a background for your game (static objects) or, for example, to put lights on your map, it is again better to do this through prefabs than using a regular copy paste. Since, perhaps, during the development process, you will rework the texture of the lantern or you will want the lanterns to shine at a certain time of the day. At this point, you will understand the full power and benefits of prefabs – a couple of minutes will be enough for you to change one prefab and the changes will be applied to all its copies. If you used a copy paste, you will have to configure each game object separately, which, as you understand, is long and inefficient.

However, this does not mean all **Prefab** instances have to be identical. You can override settings on individual prefab instances if you want some instances of a **Prefab** to differ from others.

You should also use prefabs if some game object should appear during the execution of the game using a script.

### Creating Prefabs

To create a Prefab Asset, drag a **GameObject** from the **Explorer** into the **Browser**. The GameObject, and all its components and, becomes a new Asset in your Browser.

<figure><img src="/files/bOO4lfnmYiZv7WwXjW2e" alt=""><figcaption><p>Creating Prefab via dragging GameObject in to Browser</p></figcaption></figure>

Process of creating the **Prefab** Asset also turns the original **GameObject** into a **Prefab** instance and saving it as prefab in asset, but original object stay the same, i.e not a prefab. **Prefab** instances are shown in the Inspector with blue array, and the root **GameObject** of the Prefab is shown with the blue cube Prefab icon.

You can also create a prefab by using the object's context window. Click RMB on the object and select **Create -> New Prefab**.

<div align="left"><figure><img src="/files/Tg3tTIWTFqkDVBVotpfy" alt=""><figcaption><p>Creating prefab in Context Menu</p></figcaption></figure></div>

After you have created a prefab, you will need to drag it into the Explorer window and then it will be created not as a regular object but as a prefab and will be displayed with a different icon.

<figure><img src="/files/FhsdLCjv6qJbT7yMDXNa" alt=""><figcaption><p>Prefab in Explorer</p></figcaption></figure>

You can also create instances of **Prefabs** at runtime using scripting. For more information, see [Prefabs Using Scripts](/force/force-editor/scripting/prefabs-using-scripts.md).


---

# 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://danil-dukhovenko.gitbook.io/force/force-editor/gameplay/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.
