State Machines
Interact with the Rive State Machine in Unity
This article is out of date! Find the new version here.
For more information on Rive State Machines see the respective runtime and editor documentation.
Overview
A StateMachine contains Inputs and Events and advances (plays) an animation.
State Machines are instantiated from an Arboard instance:
The state machine is played by calling advance
and passing in the delta time:
Accessing Inputs
There are three input types, each extends SMIInput
(State Machine Input):
SMIBool
contains a.Value
property, a boolean that can be set to true or false.SMITrigger
is a boolean that is set to true for one frame by calling the.Fire()
method.SMINumber
contains a.Value
property, a float that can be set to any value.
State machine inputs can be accessed in a number of different ways.
Access by name
Retrieve a state machine input by name and type.
Trigger:
Bool:
Number:
Access by index
Get the input count (length) and retrieve by index:
Access all inputs
Retrieve a list of all SMIInput
s:
Additional Resources
For a complete example see the getting-started project in the examples repository and open the StateMachineInputScene scene. Enter Play mode and in the inspector on the Main Camera component, you can interact with all available state machine inputs for the provided animation.
Last updated