Loading Assets in Rive
Loading and replacing assets dynamically at runtime.
Some Rive files may contain assets that can be embedded within the actual file binary, such as font, image, or audio files. The Rive runtimes may then load these assets when the Rive file is loaded. While this makes for easy usage of the Rive files/runtimes, there may be opportunities to load these assets in or even replace them at runtime instead of embedding them in the file binary.
There are several benefits to this approach:
Keep the
.rivfiles tiny without potential bloat of larger assetsDynamically load an asset for any reason, such as loading an image with a smaller resolution if the
.rivis running on a mobile device vs. an image of a larger resolution for desktop devicesPreload assets to have available immediately when displaying your
.rivUse assets already bundled with your application, such as font files
Sharing the same asset between multiple
.rivs
Methods for Loading Assets
There are currently three different ways to load assets for your Rive files.
In the Rive editor select the desired asset from the Assets tab, and in the inspector choose the desired export option:
See the Export Options section in the editor docs for more details.