Addressables Support
Installation
Install Addressables package (Window / Package Manage / Unity Registry)
- Update assembly definitions if you are using them (required only if updating from v1.0.x):
add Unity.Addressables and Unity.ResourceManager in the UIThemes assembly definition
add Unity.Addressables.Editor in the UIThemes.Editor assembly definition
Enable Addressable support in the Projects Settings… / UI Themes (required only if updating from v1.0.x).
Usage
Open
Theme
asset and enable Addressable SupportMark sprites, textures, fonts, etc as Addressable
Use
await Theme.SetActiveVariation("variation name", preload: true)
to change variation at runtime. Without preload, each asset will be loaded synchronously on request.
Note
Assets (sprites, fonts, etc) at the non-addressable scene will be included in the build.
Possible solutions:
- make scene addressable
- add empty variation without those assets and create script with IPreprocessBuildWithReport
and IPostprocessBuildWithReport
implementation to change variation for the build only