Rive Events
Access Rive Events in Unity.
For more information on Rive Events see the respective runtime and editor documentation.
Rive Events
With Rive events, you have the ability to subscribe to meaningful signals that get reported from animations, state machines, and Rive listeners, all created at design time from the Rive editor.
Events
Events are a way to send signals to your runtime code to execute a block of code at the right moment. They enhance the communication between designers and developers by passing along useful information.
Accessing Events
The following code demonstrates accessing all Rive events reported from an active state machine.
With a reference to the Rive Widget, you can subscribe to the OnRiveEventReported
event in your scripts:
Let’s look at a code snippet for a star-rating Rive file. If a reported event’s name is Star, the rating property of type float
and a message of type string
are retrieved from the event data (custom properties).
- Properties that can be read are bool, string, and float.
- Access a dictionary of all properties with:
reportedEvent.Properties
.
Additional Resources
For a complete example see the getting-started project in the examples repository and open the EventsScene scene.
Was this page helpful?