Data Binding Usage
Binding Rive Data to Unreal
This guide covers the usage of the ViewModel system in Unreal, which allows binding and synchronizing data between Unreal gameplay logic and Rive animations using a runtime ViewModelInstance.
1. Load the ViewModel
Obtain a ViewModel from a .riv
file:
You can also get ViewModels by index or enumerate all ViewModel names using GetInstanceNames()
.
2. Create a ViewModel Instance
Create an instance of the ViewModel to hold runtime property values:
You can also create a default predefined instance:
Or create a specific one by name:
3. Bind the Instance to an Artboard
Bind the ViewModel instance to a URiveArtboard
to establish data context:
This propagates the instance to both the artboard and its FRiveStateMachine
, ensuring synchronized behavior. Likewise, setting the ViewModel instance on a state machine sets it on the state machine’s artboard.
These operations can also be performed using Blueprints:
4. Access or Modify Properties via the ViewModel Instance
URiveViewModelInstance
exposes strongly-typed accessors:
✅ Boolean
🔢 Number
📝 String
🎨 Color
🧩 Enum
🚀 Trigger
📦 Nested ViewModels
5. 🧪 Using Accessors on Property Objects
Each URiveViewModelInstanceValue
subclass exposes GetValue()
and SetValue()
(or equivalents), enabling direct manipulation. This is especially useful if you want to cache a property for later use.
✅ Boolean
🔢 Number
📝 String
🎨 Color
🧩 Enum
🚀 Trigger
5. Respond to Property Changes
Each property value subclass (e.g. URiveViewModelInstanceString
) supports change detection.
Unbind when needed:
Or clear all bindings:
These methods are also exposed to Blueprints, allowing UI widgets to react to value changes seamlessly.
Was this page helpful?