Scripting user actions
- Last UpdatedDec 04, 2023
- 1 minute read
After a user action is created and customized, it is available for the application user, but nothing happens when triggering.
The developer must script the behavior that the user action performs.
-
You can link to the action\userActionName\state parameter. This value either starts when pressed or stops when released.
-
Use just one user action state when the action is punctual, such as showing/hiding something.
-
Use both states when the action is continuous, such as turning or moving something.
Code example
This is a code example for scripting user actions.
<!-- example of punctual action handling -->
<route from="itemName.action\userActionName\state" to="aCommand.execute" condition="@itemName.action\userActionName\state@==started" />
<!-- example of continuous action handling -->
<route from="itemName.action\userActionName\state" to="aSound.play" condition="@itemName.action\userActionName\state@==started" />
<route from="itemName.action\userActionName\state" to="aSound.stop" condition="@itemName.action\userActionName\state@==stopped" />
User action logging
When the project involves the XR Instructor, customize the newly created actions for the Log panel.