External Resource
Content List
- Action External Resource Behavior
- Condition External Resource Behavior
- Value Processing External Resource Behavior
- Example Usage of External Resource Behaviors
Action External Resource Behavior
Set External Bitmap
Description
Sets ExternalResourceId and ExternalResourceManagerId properties of an associated ExternalBitmapProvider when its action is triggered.
Common Properties
| Property Name | Type | Description |
|---|---|---|
| ExternalResourceId | String |
A unique id of an external resource to be provided. |
| ExternalResourceManagerId | String |
A unique id of an external resource manager to retrieve the external resource from. |
| ImageProvider | ExternalBitmapProviderBehavior |
External Bitmap Provider that retrieves and provides a bitmap. |
Condition External Resource Behavior
Check External Resource Change
Description
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
| Property Name | Type | Description |
|---|---|---|
| ExternalResourceId | String |
A unique id of an external resource to be provided. |
| ExternalResourceManagerId | String |
A unique id of an external resource manager to retrieve the external resource from. |
Value Processing External Resource Behavior
External Bitmap Provider
Description
Retrieves an external bitmap with ExternalResourceId from an external resource provider with ExternalResourceManagerId and provides the bitmap to an associated bitmap node.
Common Properties
| Property Name | Type | Description |
|---|---|---|
| TargetNode | Candera::AbstractNodePointer |
The Node which is modified. If not set, then the node where the behavior is attached to, will be modified. |
| ExternalResourceId | String |
A unique id of an external resource to be provided. |
| ExternalResourceManagerId | String |
A unique id of an external resource manager to retrieve the external resource from. |
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 Referencing external resource. The following usage example uses an external resource that was loaded into the solution during this operation.
External Bitmap Provider
- Drag and drop the [ Node 2D > Bitmap Node ] from the toolbox onto the scene editor, or the scene tree.
- Attach [ Behavior > External Resource > Value Processing > External Bitmap Provider ] in the Toolbox to the Behavior in the Extra Scene Tree of the placed bitmap node by drag-and-drop operation.

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

-
- 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
- Drag and drop the [ Node 2D > Bitmap Node ] from the toolbox onto the scene editor, or the scene tree.
- Attach [ Behavior > External Resource > Value Processing > External Bitmap Provider ] in the Toolbox to the Behavior in the Extra Scene Tree of the placed bitmap node by drag-and-drop operation.

- Drag and drop the [ Controls > Touchable > Button ] from the toolbox onto the scene editor, or the scene tree. Take place this operation twice (add two button control nodes).
- Attach [ Behavior > External Resource > Action > 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.

- Select the Button control, then select the Set External Bitmap behavior in the Extra Scene tree that appears.
- 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).

- Select the Button control, then select the Set External Bitmap behavior in the Extra Scene tree that appears.
- 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).

- Run the player and press the placed buttons. By pressing each button, the image specified in Set External Bitmap will be displayed.

Check External Resource Change
This example cannot be executed without Android studio installed.
- Drag and drop the [ Node 2D > Bitmap Node ] from the toolbox onto the scene editor, or the scene tree.
- Attach [ Behavior > External Resource > Value Processing > External Bitmap Provider ] in the Toolbox to the Behavior in the Extra Scene Tree of the placed bitmap node by drag-and-drop operation.
- Select Scene2D in the scene tree and attach [ Behaviors > Control > Event Handler ] to the displayed extra scene tree by drag-and-drop operation.

- Select the Scene2D in the scene tree, in the displayed extra scene tree, attach [ Behavior > External Resource > Condition > Check External Resource Change ] to the Condition of the Event Handler by drag-and-drop operation.

- Select the Scene2D in the scene tree, in the displayed extra scene tree, attach [ Behavior > External Resource > Action > Set External Bitmap ] to the Actions of the Event Handler by drag-and-drop operation.

- Select the Set External Bitmap behavior you added.
- Click the select item button on the ImageProvider in the properties panel that appears and select the External Bitmap Provider connected to the BitmapNode.

- Select the Set External Bitmap behavior you added.
- 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.
- Select Check External Resource Change in the Event Handler.
- Click the Select Item button for ExternalResourceId in the Properties panel that appears and select any external resource specified in step 9.
- Each time the image definition is changed, the displayed image should be updated.
At this time, this event is only supported on Android systems when the user has enabled or disabled the installed RRO package.