# External Resource

This page explains how to use the behaviors that operate on external resources (such as images) located **outside** the Scene Composer solution: External Bitmap Provider, Set External Bitmap and Check External Resource Change.

<p class="callout info">For how to reference external resource files, see <span style="color: rgb(230, 126, 35);">[Referencing external resource](https://doc316en.candera.eu/books/scene-design/page/referencing-external-resource)</span>.</p>

A new **FileSystemResourceManager** (identified as `FileSystem`) has been introduced, extending the functionality of the **External Resource Behaviors** (such as `Set External Bitmap` and `External Bitmap Provider`), **removing execution device restrictions**. These behaviors are now available across **all platforms**. This allows users to dynamically load image files, such as PNG and JPEG files, from the file system at runtime using **relative paths**, without embedding them in the asset binary file. This functionality is primarily used for setting images on **2D Bitmap Nodes**. Since the `ExternalResourceManager ID` property defaults to `AndroidSystem`, users must **manually enter "FileSystem"** as the value to enable file system resource support.

For further details and limitations, please refer to the <span style="color: rgb(230, 126, 35);">[External Image Behavior](https://doc316en.candera.eu/books/controls-and-behaviors/page/external-image-behaviour)</span> page.

#### Use cases

- **Render external images:** Preview images residing under an Android Studio project in Scene Composer and verify the display in Player.
- **Switch the displayed image from the UI:** Attach <span style="color: rgb(230, 126, 35);">[External Bitmap Provider](#bkmrk-external-bitmap-prov)</span> to a bitmap node, then use a button with <span style="color: rgb(230, 126, 35);">[Set External Bitmap](#bkmrk-set-external-bitmap)</span> to switch the image according to `ExternalResourceId`.
- **Detect external-resource changes:** Use <span style="color: rgb(230, 126, 35);">[Check External Resource Change](#bkmrk-check-external-resou)</span> to detect changes in the external resource setup and reload cached external objects as needed.

---

#### Action External Resource Behavior

##### Set External Bitmap

Sets ExternalResourceId and ExternalResourceManagerId properties of an associated ExternalBitmapProvider when its action is triggered.

**Common Properties**

<table border="1" id="bkmrk-property-name-type-d" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3745%;"></col><col style="width: 27.3177%;"></col><col style="width: 39.4314%;"></col></colgroup><tbody><tr><th>**Property Name**</th><th>**Type**</th><th>**Description**</th></tr><tr><td>ExternalResourceId</td><td>String</td><td>Full path to resource. (A unique ID to be provided.)

If the **ExternalResourceManagerId** is *Android*, provide the full path to the resource (a unique ID should be specified).

If the **ExternalResourceManagerId** is *FileSystemExternal*, provide the file system path in .*png* or *.jpg* format.

</td></tr><tr><td>ExternalResourceManagerId</td><td>String</td><td>External resource manager ID. (e.g., *Android*, *FileSystem*) used to retrieve the external resource.

</td></tr><tr><td>ImageProvider</td><td>ExternalBitmapProviderBehavior\*</td><td>External Bitmap Provider Behavior which sets an external image on a node and is the target receiving set resource on action.

</td></tr></tbody></table>


#### Condition External Resource Behavior

##### Check External Resource Change

Checks is external resource setup changed if test pass need to reload extand whole cache for external objects needs reload.

Reacts on ExternalResourceEvent if and only if the ExternalResourceId and ExternalResourceManagerId of the event match the condition’s properties, triggering the associated action.

**Common Properties**

<table border="1" id="bkmrk-property-name-type-d-1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3745%;"></col><col style="width: 27.3177%;"></col><col style="width: 39.4314%;"></col></colgroup><tbody><tr><th>**Property Name**</th><th>**Type**</th><th>**Description**</th></tr><tr><td>ExternalResourceId</td><td>String</td><td>External resource name ID. (A unique ID to be provided.)  
</td></tr><tr><td>ExternalResourceManagerId</td><td>String</td><td>External resource manager ID. (A unique ID to retrieve the external resource from.)

</td></tr></tbody></table>




#### Value Processing External Resource Behavior

##### External Bitmap Provider

<span lang="EN-US">Sets an image on a Render Node based on External resource Id. Retrieves an external bitmap with ExternalResourceId from an external resource provider with ExternalResourceManagerId and provides the bitmap to an associated bitmap node.</span>

**Common Properties**

<table border="1" id="bkmrk-property-name-type-d-2" style="border-collapse: collapse; width: 100%; height: 169.563px;"><colgroup><col style="width: 33.3745%;"></col><col style="width: 27.3177%;"></col><col style="width: 39.4314%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><th style="height: 29.7969px;">**Property Name**</th><th style="height: 29.7969px;">**Type**</th><th style="height: 29.7969px;">**Description**</th></tr><tr style="height: 80.1719px;"><td style="height: 80.1719px;">TargetNode</td><td style="height: 80.1719px;">Candera::AbstractNodePointer</td><td style="height: 80.1719px;">The Node which is modified. If not set, then the node where the behavior is attached to, will be modified.

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">ExternalResourceId</td><td style="height: 29.7969px;">String</td><td style="height: 29.7969px;">Full path to resource. (A unique id of an external resource to be provided.)

If the **ExternalResourceManagerId** is *Android*, provide the full path to the resource (a unique ID should be specified).

If the **ExternalResourceManagerId** is *FileSystemExternal*, provide the file system path in \*.\**png* or *.jpg* format.

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">ExternalResourceManagerId</td><td style="height: 29.7969px;">String</td><td style="height: 29.7969px;">External resource manager ID. (e.g., *Android*, *FileSystem*) used to retrieve the external resource.

</td></tr></tbody></table>

---

#### Example Usage of External Resource Behaviors

Here is an example of the use of each External Resource behavior.

#### How to reference external resources

For information on referencing external resource files, see <span style="color: rgb(230, 126, 35);">[Referencing external resource](https://doc316en.candera.eu/books/scene-design/page/referencing-external-resource)</span>. The following usage example uses an external resource that was loaded into the solution during this operation.

#### External Bitmap Provider

1. Drag and drop the \[ Node 2D &gt; Bitmap Node \] from the toolbox onto the scene editor, or the scene tree.
2. Attach \[ Behavior &gt; External Resource &gt; Value Processing &gt; External Bitmap Provider \] in the Toolbox to the Behavior in the Extra Scene Tree of the placed bitmap node by drag-and-drop operation.  
    <div drawio-diagram="8560"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1757035722.png" alt=""/></div>
3. Click ***External Bitmap Provider*** behavior and and specify the target image file to ExternalResourceId in the properties panel that appears. ExternalResourceId can be set in the following two ways. 
    1. - Enter the resource ID directly into the ExternalResourceId text box.
        - Press the select item button on the right side of ExternalResourceId, select the target file from the displayed dialog box, and press the \[ OK \] button.  
            <div drawio-diagram="8547"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710241.png" alt=""/></div>
4. The selected external resource will appear in the scene editor. 
    - Save the solution and launch Player to confirm that this external resource is displayed.


#### Set External Bitmap

1. Drag and drop the \[ Node 2D &gt; Bitmap Node \] from the toolbox onto the scene editor, or the scene tree.
2. Attach \[ Behavior &gt; External Resource &gt; Value Processing &gt; External Bitmap Provider \] in the Toolbox to the Behavior in the Extra Scene Tree of the placed bitmap node by drag-and-drop operation.  
    <div drawio-diagram="8548"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710276.png" alt=""/></div>
3. Drag and drop the \[ Controls &gt; Touchable &gt; Button \] from the toolbox onto the scene editor, or the scene tree. Take place this operation twice (add two button control nodes).
4. Attach \[ Behavior &gt; External Resource &gt; Action &gt; Set External Bitmap \] in the Toolbox to the Actions in the Extra Scene Tree of the placed Button control nodes by drag-and-drop operation.  
    <div drawio-diagram="8550"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710338.png" alt=""/></div>
5. Select the Button control, then select the Set External Bitmap behavior in the Extra Scene tree that appears.
6. Click the select item button on the ImageProvider in the properties panel that appears and select the External Bitmap Provider connected to the BitmapNode (this operation is performed for the two Button controls).  
    <div drawio-diagram="8551"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710563.png" alt=""/></div>
7. Select the Button control, then select the Set External Bitmap behavior in the Extra Scene tree that appears.
8. Click the select item button on the ExternalResourceId in the properties panel that appears and select the External Bitmap Provider connected to the BitmapNode (this operation is performed for the two Button controls).  
    <div drawio-diagram="8552"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710635.png" alt=""/></div>
9. Run the player and press the placed buttons. By pressing each button, the image specified in Set External Bitmap will be displayed.   
    <div drawio-diagram="3911"><img src="https://doc316en.candera.eu/uploads/images/drawio/2023-06/drawing-4-1686892990.png" alt=""/></div>

#### Check External Resource Change

1. Drag and drop the \[ Node 2D &gt; Bitmap Node \] from the toolbox onto the scene editor, or the scene tree.
2. Attach \[ Behavior &gt; External Resource &gt; Value Processing &gt; External Bitmap Provider \] in the Toolbox to the Behavior in the Extra Scene Tree of the placed bitmap node by drag-and-drop operation.
3. <span lang="EN-US" style="mso-ansi-language: EN-US;"><span lang="EN-US" style="mso-ansi-language: EN-US;">Select Scene2D in the scene tree and attach \[ Behaviors &gt; Control &gt; Event Handler \] to the displayed extra scene tree by drag-and-drop operation.  
    </span></span><div drawio-diagram="8553"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710711.png" alt=""/></div>
    
    <span lang="EN-US" style="mso-ansi-language: EN-US;">  
      
    </span>
4. Select the Scene2D in the scene tree, in the displayed extra scene tree, attach \[ Behavior &gt; External Resource &gt; Condition &gt; Check External Resource Change \] to the Condition of the Event Handler by drag-and-drop operation.  
    <div drawio-diagram="8554"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710806.png" alt=""/></div>
5. Select the Scene2D in the scene tree, in the displayed extra scene tree, attach \[ Behavior &gt; External Resource &gt; Action &gt; Set External Bitmap \] to the Actions of the Event Handler by drag-and-drop operation.  
    <div drawio-diagram="8555"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756710880.png" alt=""/></div>
6. Select the Set External Bitmap behavior you added.
7. <span lang="EN-US" style="font-size: 11.0pt; line-height: 107%; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 游明朝; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span lang="EN-US" style="font-size: 11.0pt; line-height: 107%; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 游明朝; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">Click the select item button on the ImageProvider in the properties panel that appears and select the External Bitmap Provider connected to the BitmapNode.  
    </span></span><div drawio-diagram="8556"><img src="https://doc316en.candera.eu/uploads/images/drawio/2025-09/drawing-4-1756711003.png" alt=""/></div>
    
    <span lang="EN-US" style="font-size: 11.0pt; line-height: 107%; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 游明朝; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">  
    </span>
8. Select the Set External Bitmap behavior you added.
9. Click External Bitmap Provider behavior and and specify the target image file to ExternalResourceId in the properties panel that appears. ExternalResourceId can be set in the following two ways. 
    - Enter the resource ID directly into the ExternalResourceId text box.
    - Press the select item button on the right side of ExternalResourceId, select the target file from the displayed dialog box, and press the \[ OK \] button.
10. Select Check External Resource Change in the Event Handler.
11. Click the Select Item button for ExternalResourceId in the Properties panel that appears and select any external resource specified in step 9.
12. Each time the image definition is changed, the displayed image should be updated.