# Inventory in UI

{% hint style="info" %}
All Inventory in the UI is already configured in all user interfaces, you can simply modify it to be the way you want, but if you want to build from scratch it is important to read this page.
{% endhint %}

## Inventory UI Manager

This script manages and creates the slots. It can also be used to **view loot items**.

<div align="left"><figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2FbGotZOj1anFyUCHbgy9s%2Fimage.png?alt=media&#x26;token=3f600640-f3b4-46a2-879f-ca681731eb0f" alt=""><figcaption></figcaption></figure></div>

| Properties                      | Description                                                                                                                                                                                                                                                                                                |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Inventory Screeen               | It is the screen where all the Inventory UI elements reside.                                                                                                                                                                                                                                               |
| Target Inventory                | Inventory you want to inspect the items. **Leave empty if you want to inspect the player's items.**                                                                                                                                                                                                        |
| Slot Prefab                     | Prefab configured from a standard slot.                                                                                                                                                                                                                                                                    |
| Hide Cursor When Exit Inventory | Hide mouse cursor when exit inventory.      <mark style="color:orange;">⚠ Pay attention to the player's configuration so that it doesn't block the FireMode when this option is unchecked.</mark>                                                                                                          |
| Lock Cursor When Exit Inventory | Lock mouse cursor when exit inventory                                                                                                                                                                                                                                                                      |
| Show Cursor When Open Inventory | Show mouse cursor when open inventory                                                                                                                                                                                                                                                                      |
| Filter Left Hand Items          | When this option is checked the left hand items do not appear.                                                                                                                                                                                                                                             |
| Slots Quantity                  | Number of Slots to instantiate.                                                                                                                                                                                                                                                                            |
| Inventory Scroll View Content   | Content of a [ScrollView ](https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-ScrollRect.html)that contains the [Grid Layout Group](https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-GridLayoutGroup.html) component, which will automatically arrange the Slot spacing. |
| Slots                           | Generated slots (not necessarily, if you set the **Slots Quantity** to 0 and assign the slots here, it's the same)                                                                                                                                                                                         |
| Is Loot View                    | This option create a loot checker and will always activate the Loot View screen when the player rolls over a loot. <mark style="color:orange;">⚠ Use an Inventory UI Manager for Loot View.</mark>                                                                                                         |
| Player                          | The player, you can leave this variable empty.                                                                                                                                                                                                                                                             |
| Character Layer                 | Character layer, if you are using another layer for Loot, add the option here.                                                                                                                                                                                                                             |
| Check Loot Radius               | Radius that the player can collect loot.                                                                                                                                                                                                                                                                   |

See below how to set the elements:

<div align="center"><figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2FNYQckJW4osUYrbfGbJ2u%2Fimage.png?alt=media&#x26;token=5ae492ef-af81-4055-b194-9096dc5555ea" alt=""><figcaption></figcaption></figure></div>

## Inventory Slot UI

This component is fundamental for the functioning of the Inventory UI, with it it is possible to draw icons of items in the slot, equip when dropping an item in the slot, set and draw sequential items.

<div align="left"><figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2F4tKGfVMmwTAvzoQURZwF%2Fimage.png?alt=media&#x26;token=4532f80f-1cd8-4777-b8ab-d00f0d9fa47d" alt=""><figcaption></figcaption></figure></div>

| Properties               | Description                                                                                                                                                                                                                                                                                                                   |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Inventory                | inventário para a troca de informação                                                                                                                                                                                                                                                                                         |
| Item ID To Draw          | ID of the item to be drawn <mark style="color:orange;">⚠ if it is a slot generated by the</mark> [<mark style="color:orange;">**Inventory UI Manager**</mark>](#inventory-ui-manager)<mark style="color:orange;">, this ID is automatically set</mark>                                                                        |
| Draw Sequential Item     | Draw the item by sequence and not by ID                                                                                                                                                                                                                                                                                       |
| Sequential To Draw       | Sequential Slot to draw the item  <mark style="color:green;">⚠ Example: draw the player's primary weapon, which would be in the first slot</mark>                                                                                                                                                                             |
| Set Sequential On Drop   | Sets the item in Sequential Slot of inventory when an item is dropped in this slot.              <mark style="color:orange;">⚠ This option should not be used on normal slots instantiated by</mark> [<mark style="color:orange;">**Inventory UI Manager**</mark>](#inventory-ui-manager)<mark style="color:orange;">.</mark> |
| Slot Item Image          | Image that will draw the icons of the items                                                                                                                                                                                                                                                                                   |
| Slot Health Bar          | Image(Filled Type) in to show the "health" of the item.                                                                                                                                                                                                                                                                       |
| Item Without Icon Sprite | Sprite that will appear when the item doesn't have a sprite icon assigned.                                                                                                                                                                                                                                                    |
| Empty Slot Sprite        | Sprite that will appear when the slot is empty.                                                                                                                                                                                                                                                                               |
| Item Quantity Text       | Text that counts the quantity of the items                                                                                                                                                                                                                                                                                    |
| Outline                  | Image that do an outline effect when the cursor is over the slot.                                                                                                                                                                                                                                                             |
| Enable Options           | Activates the buttons that appear when you click on the slot (Use, Equip, Unequip, Drop)                                                                                                                                                                                                                                      |
| Auto Equip On Drop       | Equip an item on drop in this slot                                                                                                                                                                                                                                                                                            |
| Is a Loot Slot           | Informs other slots and Inventory UI Managers that this slot comes from a loot   <mark style="color:blue;">⚠ No need to create a different slot for loots, Loot View checks this option automatically</mark>                                                                                                                  |
| Allow Items With Tags    | Item filter by tags, here you put the tags of the type of item that the slot can support   <mark style="color:green;">⚠ Example: Primary Weapon tag and etc...</mark>                                                                                                                                                         |
| Allow Any Item           | Allow any item regardless of item tag                                                                                                                                                                                                                                                                                         |
| Options Panel            | Panel with all Option Buttons inside (Use, Equip, Unequip, Drop)                                                                                                                                                                                                                                                              |
| Equip Button             | Equip Button in Slot                                                                                                                                                                                                                                                                                                          |
| Unequip Button           | Unequip Button in Slot                                                                                                                                                                                                                                                                                                        |
| Use Button               | Use Button in Slot                                                                                                                                                                                                                                                                                                            |
| Drop Button              | Drop Button in Slot                                                                                                                                                                                                                                                                                                           |

<figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2FpM6RiwRWQpO3nqnpFxGZ%2Fimage.png?alt=media&#x26;token=b2341562-90db-4010-85d5-5ff89f17ccef" alt=""><figcaption><p>Hierarchy and Inspector organization of a standard Slot Prefab</p></figcaption></figure>


---

# 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://julhiecio.gitbook.io/ju-tps-documentation/game-development/how-to-use-inventory-and-add-items/inventory-in-ui.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.
