init function).
It serves as a bridge between your script and the Rive runtime, giving you access to:
- Update scheduling — Request that your node be updated on the next frame.
- Data (ViewModels) — Access the ViewModel data context bound to the node or the root artboard.
- Assets — Retrieve named assets (images, blobs, and audio) that have been added to the Rive file.
Methods
markNeedsUpdate
Marks the object as needing an update on the next frame.
Call this when something has changed (e.g., from a listener callback) and you need the runtime to re-invoke your node’s update function.
viewModel
Returns the ViewModel bound to the node’s immediate data context. This is the most common way
to read data-bound properties from a script.
rootViewModel
Returns the ViewModel bound to the root artboard’s data context.
Useful when you need to access top-level data from a deeply nested node.
dataContext
Returns the data context provided to this node.
image
Returns an image asset by name, or nil if not found.
The returned image can be drawn via drawImage.
blob
Returns a blob (raw binary data) asset by name, or nil if not found.
Useful for loading custom data files embedded in the Rive file.
audio
Returns an AudioSource asset by name. The returned source can be played using the global Audio API.