Learn more about Variables to fully understand how to use Set Variable Action.
How to use Set Variable Action
When an Event is performed, a variable can be set to a new value in the Set Variable Action by an expression – it can be either updated to another variable or a custom calculation. Following Events have access to Set Variable Action. Learn how to use Set Variable Action through how-to steps in the Variables doc.Events supporting Set Variable Action
When an Event is performed, a variable can be set to a new value in the Set Variable Action by an expression – it can be either updated to another variable or a custom calculation. Following Events have access to Set Variable Action Variable Change Event Start Event Mouse Up Event Mouse Down Event Mouse Hover Event Key Up Event Key Down Event Key Press Event Scroll Event Drag and Drop Event Distance Event State Change Event Collision Event Trigger Area EventSet Variable Action properties
Select Variable
Select the variable to be updated via the Set Variable Action. The dropdown list will access any variables that are available on the current file.Add Expression
Create an expression to which the selected variable should be updated. The following variable types can be used:| Variable type | Defined by | Usage |
|---|---|---|
| 🤹 Variables | Number, String, Boolean, Timers, Counter or Random | Variables can store values that are reusable. For detailed explanation read the Variables doc. |
| ℹ️ Object Property | Object’s position, rotation, or scale (X, Y, Z), or it’s width, height and depth as a number, e.g.: 100 | Capture object property changes, and save them as variables to create advanced interactions. |
| 🖱️ Mouse Position (2D) | The position of the mouse on the screen is defined by X and Y as numbers. | Animate or manipulate objects based on the mouse position |
| 💥 Mouse Hit Position (3D) | The position of the mouse hitting an object in 3D space, as Position X, Y, or Z of the hit location, or the Position X, Y, and Z of the object that was hit. | Create interactions based on specific hit positions, e.g.: visualize hit in 3D space. |
| Symbol | Operator |
|---|---|
+ | Add |
- | Subtract |
* | Multiply |
/ | Divide |
Random | Random value |
( ) | Group calculations with parenthesis |
- Variable A + Variable B
- Variable A * 10 / 2
- (Variable A + Variable B) * 10

