# Asset Management

***

## EntityAssetUnload

**Create An Action That Unloads An Asset From The Scene, Stops The Asset From Rendering And Retains The Asset In Memory**

This guide provides instructions for setting up the **EntityAssetUnload** action. In the sample app, the trigger area is outlined in blue. Once the avatar enters into the trigger area, the asset stops rendering in the scene. This will decrease draw calls and improve frames per second, but the asset will be retained in memory.&#x20;

| <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FmD093SK4utVSIGDDpZBq%2Fimage.png?alt=media&#x26;token=c5e0dc21-9fa8-4e10-894e-6b147fe6eb0c" alt="" data-size="original"> | <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FHz9lUzAnPPbXENyM8YM2%2Fimage.png?alt=media&#x26;token=36050bcc-343a-4f17-8835-f617ae266aaa" alt="" data-size="original"> |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| When the avatar is outside the blue trigger area, the house asset is being rendered.                                                                                                                                                                       | When the avatar enters the blue trigger area, the house asset is unloaded, but is retained in memory.                                                                                                                                                      |

In this example, a trigger is created and when triggered, an action unloads an object. Any object can be used as a trigger, as long as the object has a collision component. This example uses a 3D box as the trigger area.

{% stepper %}
{% step %}

### Create a trigger area

A. Create a new **3D Box** entity.

B. The **Collision** component is not required for **EntityAssetUnload** action to work. The **Collision** component is required for the **EntitySubscribeTriggerEnter** trigger that will be used in this example.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the **Edit Viverse Extension** button.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2Fx5zQ87MdU3H9scadoo7k%2Fimage.png?alt=media&#x26;token=4fa5cf76-77c8-4a40-a491-cb5719822606" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the EntityAssetUnload action

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **EntitySubscribeTriggerEnter**.

C. Add **local-player** to the **tags to filter** field.

D. Add an **Action** and select **EntityAssetUnload.**

E. Add an object that will be unloaded when the avatar enters the trigger area. The **House2** entity has been added to the **pick up specify execution entity**.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FU8FsaQLWT1uLj65jFKHs%2Fimage.png?alt=media&#x26;token=cf259f50-a764-45ea-9884-775b36b9e531" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## EntityAssetReload

**Create An Action That Reloads An Asset Into The Scene From Memory And Causes The Asset To Be Rendered**

This guide provides instructions for setting up the **EntityAssetReload** action. In the sample app, the trigger area is outlined in blue. Once the avatar leaves the trigger area, the asset is reloaded from memory and starts rendering in the scene.

| <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FB6QNcToSWakARA29aQvm%2Fimage.png?alt=media&#x26;token=41ff62b0-cbb4-4f9c-9017-42265f3f030d" alt="" data-size="original"> | <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FzEUza6wpzKV2UMVarqpE%2Fimage.png?alt=media&#x26;token=dac9e9be-5496-46af-8275-1f930e1067f6" alt="" data-size="original"> |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| When the avatar enters the blue trigger area, the house asset is unloaded, but is retained in memory.                                                                                                                                                      | When the avatar leaves the blue trigger area, the house asset is reloaded from memory.                                                                                                                                                                     |

In this example, a trigger is created and when triggered, an action reloads an object. Any object can be used as a trigger, as long as the object has a collision component. This example uses a 3D box as the trigger area.

{% stepper %}
{% step %}

### Create a trigger area

A. Create a new **3D Box** entity.

B. The **Collision** component is not required for **EntityAssetReload** action to work. The **Collision** component is required for the **EntitySubscribeTriggerLeave** trigger that will be used in this example.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the **Edit Viverse Extension** button.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2F6RQIsMmNBluj33s1hwmS%2Fimage.png?alt=media&#x26;token=e1ece091-c898-482f-b454-d8efd2466219" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the EntityAssetReload action

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **EntitySubscribeTriggerLeave**.

C. Add **local-player** to the **tags to filter** field.

D. Add an **Action** and select **EntityAssetReload.**

E. Add an object that will be unloaded when the avatar enters the trigger area. The **House2** entity has been added to the **pick up specify execution entity**.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FUjHl5QvOW2GMBFPYWazU%2Fimage.png?alt=media&#x26;token=755193ea-b6b9-4f2c-8b7b-cc2bf38f2dde" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## EntityDestroy

**Create An Action That Destroys An Asset, Removes It From Memory and Stops It From Rendering**

This guide provides instructions for setting up the **EntityDestroy** action. In the sample app, the trigger area is outlined in blue. Once the avatar enters the trigger area, the asset is destroyed, which removes it from memory and stops it from rendering.

| <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FeOrA6Lwxb2l3K4VZUhsB%2Fimage.png?alt=media&#x26;token=f456925c-1b45-4c01-a029-776e2d2d6cb1" alt="" data-size="original"> | <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FRvDtUp1T4GmWX4b97hIU%2Fimage.png?alt=media&#x26;token=7f2211f5-e6a0-43bf-b51b-7a08a4c5a77b" alt="" data-size="original"> |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| When the avatar is outside the blue trigger area, the house asset is being rendered.                                                                                                                                                                       | When the avatar enters the blue trigger area, the house asset is destroyed and removed from memory.                                                                                                                                                        |

In this example, a trigger is created and when triggered, an action destroys an object. Any object can be used as a trigger, as long as the object has a collision component. This example uses a 3D box as the trigger area.

{% stepper %}
{% step %}

### Create a trigger area

A. Create a new **3D Box** entity.

B. The **Collision** component is not required for **EntityDestroy** action to work. The **Collision** component is required for the **EntitySubscribeTriggerEnter** trigger that will be used in this example.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the **Edit Viverse Extension** button.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FpxbMocapd5lvyKxLc8aO%2Fimage.png?alt=media&#x26;token=71de7b81-ad7b-4ff5-808c-ec4902484f8f" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the EntityDestroy action

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **EntitySubscribeTriggerEnter**.

C. Add **local-player** to the **tags to filter** field.

D. Add an **Action** and select **EntityDestroy.**

E. Add an object that will be destroyed when the avatar enters the trigger area. The **House2** entity has been added to the **pick up specify execution entity**.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2F5b0fo1G4xIcfOEMo9WzJ%2Fimage.png?alt=media&#x26;token=893bfb2e-4246-4a8a-aaee-af5dc88dab39" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}
