Learn more about Variables to fully understand how to use Variable Control Action.
How to use Variable Control Action
When an Event is performed, a dynamic variable can be controlled with the following interaction types:Play, Pause, Stop , Restart, or Toggle - Ping Pong along with a delay value.
Here is a simple how-to example of interacting with the dynamic variable via a mouse click.
Video demonstrating how to use Variable Control Action with Dynamic Counter Variable.
-
In a new scene, create a cube and a dynamic variable of type
Counterfrom the Variable panel. - Set the Interval value to “0.001” to make the counter grow faster.
- Select the cube and assign the counter variable to the X position of the cube.
-
Add an event in the right sidebar in the events section by clicking the “+” icon.
- Change the event type in the top dropdown to “Mouse Down”.
- Add an action “Variable Control” and expand it by clicking on the “>” icon.
-
Click on the dropdown in the Variable Control Action and select the variable to be controlled – the
Counterfor this example. - Enter Play mode and click on the cube to see it moving along the X axis over time.
Events supporting Variable Control Action
The following Events have access to Variable Control Action.- Start Event
- Mouse Up Event
- Mouse Down Event
- Mouse Press Event
- Mouse Hover Event
- Key Up Event
- Key Down Event
- Key Press Event
- Scroll Event
- Drag and Drop Event
- Variable Change Event
- Distance Event
- State Change Event
- Collision Event
- Trigger Area Event
- Screen Resize Event
Variable Control Action properties
Select Dynamic Variable
Select the dynamic variable to be updated via the Variable Control Action. The dropdown list will access any dynamic variables that are available in the current file.Interaction
Set the type of interaction that should occur when an event is performed. Play → Plays the dynamic variable. Pause → Pauses the dynamic variable. Play/Pause → On event trigger, plays or pauses the dynamic variable based on the current state. Stop → Stops the running dynamic variable. Restart → Restarts the dynamic variable. Toggle - Ping Pong → Reverses the dynamic variable.Delay
Adds a delay to the interaction of the Variable Control Action to take place.
Restart and Toggle interactions are only available for Counter Dynamic Variable.

