> For the complete documentation index, see [llms.txt](https://akila.gitbook.io/fps-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://akila.gitbook.io/fps-framework/tutorials/systems/interactions/pickable.md).

# Pickable

A component responbile for handling pickable items.

The **Pickable** component is an interactable component responsible for adding the target item to your inventory. The item can be either a **collectable** or an **inventory item**:

* **Collectable items** include things like ammo.
* **Inventory items** include firearms, throwables, and other usable items.

When the player interacts with an object that has the Pickable component, it will be added to their inventory according to its type.

## Creating A Pickable

To create a new **Pickable** item, follow these steps:

1. Create an empty GameObject.
2. Attach the **Pickable** component to the GameObject.
3. Set the layer of this GameObject to **"Interactable"** to ensure it can be interacted with.

This setup allows the item to be picked up and added to the player's inventory when interacted with.

<figure><img src="https://512600823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLQgz9gGwkU5HhRwKT3te%2Fuploads%2FDcygtIFRcBDbhp18yUF8%2FScreenshot%202025-04-12%20212159.png?alt=media&amp;token=73d5284b-1f4e-47d2-886e-87d946463d90" alt=""><figcaption></figcaption></figure>

As shown above, a **cube** is created for visualization purposes, with the **Pickable** component attached, the layer set to **"Interactable"**, and a **Box Collider** added. This setup allows you to visually see the pickable item in the game scene and ensures that it is properly interactable when the player approaches it.

### Item Pickables

{% hint style="info" %}
To create a pickable item, the field "Type" must be set to "Item"
{% endhint %}

With this setup complete, if you enter play mode and try to interact with the item, you may see a warning message saying **"Pickable is inactive or item is null..."**. This happens because the item is not assigned yet. To fix this, assign an **Inventory Item** to the **"Item To Pickup"** field.

You can assign the firearm you created following the [Basics ](/fps-framework/tutorials/character/firearm/basics.md)page, any of the default firearms, or throwables. For this example, you can use the default **Assault Rifle\_1**.

<figure><img src="https://512600823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLQgz9gGwkU5HhRwKT3te%2Fuploads%2F8SBFODfNVSlOClFzQQy7%2FScreenshot%202025-04-12%20213108.png?alt=media&amp;token=ad4fde5e-3287-4152-abf6-7d2152ae0e07" alt=""><figcaption></figcaption></figure>

The pickable item now is working as intended.

### Collectable Pickables

{% hint style="info" %}
To create a collectable pickable, the field "Type" must be set to "Collectable"
{% endhint %}

By setting the field "Type" to "Collectable", the inspector of the Pickable component changes as seen below.

<figure><img src="https://512600823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLQgz9gGwkU5HhRwKT3te%2Fuploads%2FDDdLTZrUVj0bkaI9tsQe%2FScreenshot%202025-04-12%20213719.png?alt=media&amp;token=a12b99ad-21b3-47e9-942b-705b74b2214f" alt=""><figcaption></figcaption></figure>

As seen above, there are two fields: **"Collectable Identifier"** and **"Amount To Collect"**.

* **Collectable Identifier** functions as the item to pick up, but specifically for collectables (like ammo).
* When the item is picked up, the system searches the inventory for a matching collectable.
* If found, it increases the collectable’s **Count** by the value set in **"Amount To Collect"**.

As seen below, the **Inventory** has a list called **"Collectables"**, which is what the **Collectable Pickable** interacts with. When a collectable item is picked up, it searches this list to find a matching identifier and adds the specified amount to it.

<div align="left"><figure><img src="https://512600823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLQgz9gGwkU5HhRwKT3te%2Fuploads%2FzCzaC1vllhnAqZARJZg6%2FScreenshot%202025-04-12%20214129.png?alt=media&amp;token=b2b0dbe4-0c42-445a-842b-94f162901927" alt="" width="563"><figcaption></figcaption></figure></div>

This only works if the **Collectable Identifier** in the Pickable component matches one of the **Collectable items** in the Inventory's **Collectables list**. If there's no match, the item won't be added when picked up.
