# Loot Object Receiver

This type of component is responsible for information when hovering over the selected object.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbEkU1rU1x6rlFq9LA%2Fimage%20\(64\).jpg?alt=media\&token=c3aac124-8e80-4a3d-b387-272235dede4b)

Each selected item has its own Canvas, which requires additional configuration.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbFkzXYToDEv12G7Tg%2Fimage.png?alt=media\&token=611abca6-0262-450e-9d98-0b8a0c80c337)

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbFr2zn424aP9ICIv7%2Fimage.png?alt=media\&token=545010c3-4dee-420f-8ae9-ced72f110858)

And so let's take a look at all the components we need in order:

## UI Billboard Effect&#x20;

He is responsible for ensuring that the canvas always looks at the player.

### Automatically

We can set the target via the object tag.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbGELu7WmEGV0VLxbo%2Fimage.png?alt=media\&token=4db567ef-f07c-4bf4-a3cf-269787c80774)

{% hint style="success" %}
**Example:**

If we work in **Prefab**, then we can't manually specify the camera and then this method will help us, when initializing an object, the system will find an object with the necessary tag itself and the canvas will always look at it.
{% endhint %}

### Manual

We can pass the target that the Canvas will look at manually.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbGlPtKwtiu2T9LWYs%2Fimage.png?alt=media\&token=d8b78ab6-a4d9-4dc9-b64f-c8da93d3a745)

## Rect Transform Placer

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbHnE299kMPOPadVD8%2Fimage.png?alt=media\&token=d91fabb1-792a-4636-a941-36d03423e6f8)

Responsible for the position of the canvas relative to the object.

{% hint style="success" %}
**Example:**

When we throw an object, the canvas is still static relative to the object, and does not rotate with it.
{% endhint %}

| Name            | Description                                                                                                                                                                                                                                                                                                  |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Side            | <p><strong>Top -</strong> canvas will be located above the object.</p><p><strong>Bottom -</strong> canvas will be located under the object.<br><strong>Left -</strong> canvas will be located to the left of the object.<br><strong>Right -</strong>  canvas will be located to the right of the object.</p> |
| Relative Object | A reference to the object.                                                                                                                                                                                                                                                                                   |

### Advanced Settings

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbLF3Q4Lpd657Ief6_%2Fimage%20\(65\).jpg?alt=media\&token=c10e8083-24a9-445e-8148-15b888648aa0)

| Name      | Description                                                                           |
| --------- | ------------------------------------------------------------------------------------- |
| Smooth    | The speed of the canvas movement.                                                     |
| Tolerance | The value by which the canvas can deviate before returning to the specified position. |
| Offset    | The distance at which the canvas will be located from the object.                     |

## Rect Transform Resizer

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbMd_gynH1ABqZ43f0%2Fimage.png?alt=media\&token=2f4a1424-abe5-489e-8769-45cddfd7c759)

Responsible for animating the appearance and disappearance of the canvas.

{% hint style="info" %}
All manipulations with the canvas size and so on occur through the code.
{% endhint %}

### Show Event

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbN5OukXP5qW-Qr-Si%2Fimage.png?alt=media\&token=40838fdd-69a8-4977-ae58-7d03b47c1d76)

| Name      | Description                                                                                                                                               |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Component | Here we select the **LootWeapon** component.                                                                                                              |
| Event     | <p>Here we select the <strong>OnBecomeReceiverVisibleCallback</strong> event.<br>The event that must occur for the <strong>canvas</strong> to appear.</p> |
| Arg 1     | The time for which the animation of the **canvas** appearance will occur. **(in seconds)**                                                                |
| Arg 2     | The curve along which the **canvas** will appear.                                                                                                         |

### Hide Event

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbNAxwZSyhK9b-5Kj7%2Fimage.png?alt=media\&token=700cc7c4-0de5-4da9-aa07-57a42a0aeb5b)

| Name      | Description                                                                                                                                                     |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Component | Here we select the **LootWeapon** component.                                                                                                                    |
| Event     | <p>Here we select the <strong>OnBecomeReceiverVisibleCallback</strong> event.</p><p>The event that must occur for the <strong>canvas</strong> to disappear.</p> |
| Arg 1     | The time it takes for the **canvas** to disappear animation to occur. **(in seconds)**                                                                          |
| Arg 2     | The curve along which the **canvas** will disappear.                                                                                                            |

## Canvas Camera Initializer

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbP-D_QKD8irSr8y2X%2Fimage.png?alt=media\&token=ad67d65c-6716-45fc-81bf-81cfbd5c31b6)

This component is needed in order to place the camera in the Canvas component.

{% hint style="info" %}
Since we are working with Prefab, we do not have access to the camera and this component, when initialized by the tag, finds the camera and places it in the Canvas component.
{% endhint %}

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbPrusdnWMwYW53LIC%2Fimage%20\(66\).jpg?alt=media\&token=0133f330-4ccb-47d3-b45a-e226f2de07ff)

## Loot State UI

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbQ3_RpoBDIb9eYfWZ%2Fimage.png?alt=media\&token=efce04b1-5dc4-48b3-a85f-10c4fb9e5ce6)

It is responsible for displaying a certain **UI element** when receiving a corresponding message from the selected item.

The selected weapon has several messages:

1. **Inventory Full** - the inventory is full, it is impossible to pick up an item.
2. **Loot Available** - there is a place in the inventory, you can pick up an item.
3. **Replace** - such an item is already in the inventory, change the item.

{% hint style="info" %}
The list of messages can be replenished, only default messages are specified here.
{% endhint %}

### **Add New States**

In order to add a new message display, click on the plus sign.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbSS57nRznCvaWN9VH%2Fimage%20\(67\).jpg?alt=media\&token=17139ca9-a3b9-43e1-a8b7-2280ba4382b4)

In the window that appears, specify the text of the message and a link to the **UI element** with the text prepared for this message.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbSsUDL86eELdNVsr4%2Fimage%20\(68\).jpg?alt=media\&token=743ed284-853c-4601-95c0-32af12333109)

### Loot Object&#x20;

Here we put a link to the Loot Weapon component of the selected item.

### Example

**Loot Available**&#x20;

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbRiVQI2MT26qRsuLg%2Fimage.png?alt=media\&token=e0df17af-0042-4621-98fe-729a2d4566f1)

**Inventory Full**

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbRwx8YXIIxxXhPClW%2Fimage.png?alt=media\&token=ef07f82e-b091-4912-8c6d-8974f61c76e6)

#### Replace

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbS1IK_jQm2C0FRXrE%2Fimage.png?alt=media\&token=7689ed4f-6195-4e69-8be0-31307d6c518b)

## UI Element Visibility

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-Mdb3vGp7lgWvIM8E_LZ%2F-MdbVQm1W9_YtA431lUM%2Fimage.png?alt=media\&token=c1dc9ba1-c419-4eb4-b6ef-c51ff1ef0e01)

This component is responsible for displaying the selection button.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-MdbVcYzhv99TqWf-4aE%2F-MdbVt0t-KPVYK0B-Z-6%2Fimage%20\(69\).jpg?alt=media\&token=23805dbd-3e8f-46de-8e38-e814cb245e61)

### Enable Callback

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-MdbVcYzhv99TqWf-4aE%2F-MdbW39xkio2jVKDjjDa%2Fimage.png?alt=media\&token=db5f9985-f106-4f6c-818d-b05c0f616482)

| Name      | Description                                                                                                                 |
| --------- | --------------------------------------------------------------------------------------------------------------------------- |
| Component | Here we select the **LootWeapon** component.                                                                                |
| Event     | Here we select the **OnBecomeReceiverVisibleCallback** event. The event that must occur for the selection button to appear. |

### Disable Callback

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-MdbVcYzhv99TqWf-4aE%2F-MdbW5nfMpAfVqusdFRx%2Fimage.png?alt=media\&token=589f4d2f-23ae-4f8c-ac08-3db96cd6ba8e)

| Name      | Description                                                                                                                                                                 |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Component | Here we select the **LootWeapon** component.                                                                                                                                |
| Event     | <p>Here we select the <strong>OnBecomeReceiverVisibleCallback</strong> event.</p><p>This component is responsible for displaying the <strong>selection button</strong>.</p> |

## Loot Long Press Image Fill

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-MdbVcYzhv99TqWf-4aE%2F-MdbYmoU8j7zMXa62qlo%2Fimage.png?alt=media\&token=9ad14e3e-0c1c-4995-8ce0-35c1d194e89d)

This component processes the click of the selection button and fills the selection bar.

![](https://4102492771-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbGcEmnwAxQ5XmsXrVA%2F-MdbVcYzhv99TqWf-4aE%2F-MdbZK-hoy2uD2tPDu9B%2Fimage%20\(71\).jpg?alt=media\&token=2eb4664c-33fb-4afd-b51a-79f1745317fa)

**Loot Object** - a link to the **Loot Weapon** component of the selected item.
