Executing JSON Methods of the Activity
This explains how to execute methods of a Component class defined in ActivityScene.json (within the activity folder) from a Component class defined in Scene.json.
Info
SDK Version : 13.7
OS : Windows 11
Unity : 2022.3.6f1
Browser : Google Chrome
Details
Consider the scenario illustrated below:
- From ComponentA, you want to execute the
Hogemethod of ComponentB.- You cannot directly reference the component of a sub-scene (indicated by the red line in the figure).
- However, if they are within the same environment, you can use
system.Item_GetComponentor similar methods to obtain a reference.
- However, if they are within the same environment, you can use
- Therefore, you need to execute it through an item.
- You cannot directly reference the component of a sub-scene (indicated by the red line in the figure).

Steps
1. Obtain the Item that Contains ComponentB
If you have the item, even if it is in a sub-scene, you can refer to it using hsItemGet as long as it’s an Item (not a Component).
Info
For example, hsItemGet("ActivityItem/ItemB") uses a hierarchical path (Activity-type item name)/(Name of the target in the sub-scene).
This works because the activity-type item includes the sub-scene.
2. Use the Retrieved Item to Execute the Method Directly
- For example:
csharp itmB.CallComponentMethod("ComponentB", "Hoge", "HogeParam");- Since this is
CallComponentMethod, theHogemethod must have a single string parameter and return void.
- Since this is