CustomAssetLoaderCallback
. This lets you change fonts, images, or audio files while your Rive file is playing, making it possible to create dynamic visuals.
true
if you’ve handled the asset loading, or false
to let the runtime handle it using the default loading behavior.
Here’s an example showing how you might swap a font at runtime:
Rive.File.Load()
includes a fallbackToAssignedAssets
parameter.
If set to true
and your custom loader doesn’t handle a certain asset, the runtime will look for references assigned to your Rive asset in the Unity Inspector and automatically load them if they exist. This is handy when you only want to replace some assets and rely on default references for the rest.
FontOutOfBandAsset
: For font files
ImageOutOfBandAsset
: For image files
AudioOutOfBandAsset
: For audio files
EmbeddedAssetReference
before setting the asset. Each asset type has its own reference class with specific setter methods:
Load()
on your Out-Of-Band asset before using it in the callback
Unload()
on your assets when they’re no longer needed
Dispose()
on the Rive file when you’re done with it
OutOfBandAsset.Create<T>()
method. Here, the bytes
parameter should be the raw file data for the asset.
This works for fonts, images, and audio, as long as you use the appropriate type (FontOutOfBandAsset
, ImageOutOfBandAsset
, or AudioOutOfBandAsset
).