Coroutine node and statements
- Last UpdatedFeb 19, 2025
- 3 minute read
Coroutine node
Coroutine is a powerful scripting tool that extends the characteristics of Commands (loops, locals, setfields), mixes them with some of the Scheduler node (Sequential execution), and adds some more functionality.
Coroutine node
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|
|
|
|
|
|
|
Elements
These elements can be used inside a Coroutine node.
Symbol legend
Full support
Limited support
No support
Command statements
All statements defined for Command node and statements can be used inside Coroutine.
Differences between Command and Coroutine
The main differences between a Command and a Coroutine are:
-
Coroutines execution can be interrupted by a wait statement and stay waiting until the time a particular condition is verified. Upon exiting the wait statement, the coroutine restarts executing its statements.
-
The local variables keep their values for the whole execution of a Coroutine.
-
Coroutines enable jumping forwards and backwards through their statements.
-
A Coroutine can be executed one at a time. Re-executing causes the Coroutine to start from the beginning.