Data Binding
Binding Rive Data to Unity and vice versa
Quick Start
Data binding allows you to establish connections between your Unity code and your Rive graphics. This creates a two-way reactive system where changes in your code affect the Rive design, and changes in the design can trigger responses in your code.
Auto Binding in the Inspector
The simplest way to use data binding is through the Unity Inspector. The Rive Widget component includes a Data Binding Mode setting that offers three options:
- Auto Bind Default: Automatically binds the default view model instance (marked as “Default” in the Rive editor)
- Auto Bind Selected: Lets you select a specific instance from a dropdown
- Manual: Requires you to set up binding through code (see the Data Binding documentation for details)
Usage Example
Once your Rive Widget is bound to a view model instance, you can access and modify its properties from your Unity scripts. The following example shows how to get, set, and observe different types of properties:
Explore the RewardsDataBinding scene in the getting-started example project for a practical implementation in Unity.
Auto Binding in the Inspector
The simplest way to use data binding is through the Unity Inspector. The Rive Widget component includes a Data Binding Mode setting that offers three options:
- Auto Bind Default: Automatically binds the default view model instance (marked as “Default” in the Rive editor)
- Auto Bind Selected: Lets you select a specific instance from a dropdown
- Manual: Requires you to set up binding through code (see the Data Binding documentation for details)
Usage Example
Once your Rive Widget is bound to a view model instance, you can access and modify its properties from your Unity scripts. The following example shows how to get, set, and observe different types of properties:
Explore the RewardsDataBinding scene in the getting-started example project for a practical implementation in Unity.
If you choose to use the low-level API to control the render loop, you’ll need to manually set up data binding in your scripts.
For reference, check this RiveScreen example that demonstrates one way to implement auto binding in a custom render loop.
Using the low-level API requires additional implementation effort and understanding of the Rive runtime. Unless you have a specific need to setup a custom render loop, we recommend using the Component API.
For a deeper understanding of data binding concepts and more advanced usage, see the Data Binding documentation.