Actions

Set Variable Action

Set Variable Action can update the value of a variable defined by an expression. The expression can reference another variable or variable helpers.

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 Event

Set 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 typeDefined byUsage
🤹 VariablesNumber, String, Boolean, Timers, Counter or RandomVariables can store values that are reusable. For detailed explanation read the Variables doc.
ℹ️ Object PropertyObject’s position, rotation, or scale (X, Y, Z), or it’s width, height and depth as a number, e.g.: 100Capture 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.

The following math operations can be used in formulas:

SymbolOperator
+Add
-Subtract
*Multiply
/Divide
RandomRandom value
( )Group calculations with parenthesis

Some example formulas to spark ideas

  • Variable A + Variable B
  • Variable A * 10 / 2
  • (Variable A + Variable B) * 10

Using Set Variable Action with Conditional Action

Conditional Action allows you to create more sophisticated Set Variable Actions. Read the doc to learn more about it.

On this page