> For the complete documentation index, see [llms.txt](https://docs.viverse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.viverse.com/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/no-code-tools/trigger-and-action/asset-management.md).

# Asset Management

This document provides several guides that can be used to optimize VIVERSE projects by controlling when assets are rendered.

***

## 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.

| <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FzEUza6wpzKV2UMVarqpE%2Fimage.png?alt=media&amp;token=dac9e9be-5496-46af-8275-1f930e1067f6" alt="" data-size="original"> | <img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FB6QNcToSWakARA29aQvm%2Fimage.png?alt=media&amp;token=41ff62b0-cbb4-4f9c-9017-42265f3f030d" 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&amp;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&amp;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&amp;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&amp;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%2Fx5zQ87MdU3H9scadoo7k%2Fimage.png?alt=media&amp;token=4fa5cf76-77c8-4a40-a491-cb5719822606" 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&amp;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&amp;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&amp;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&amp;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&amp;token=893bfb2e-4246-4a8a-aaee-af5dc88dab39" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.viverse.com/playcanvas-toolkit/building-with-the-playcanvas-toolkit-legacy-v3/no-code-tools/trigger-and-action/asset-management.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
