{{docsMenuData.data.title}}

Unity Addressables Support

WFW v1.3.0+ required, Unity Addressables 2.9.1+

Why Use Addressables?

Adding Addressables support allows the theme data file to be accessed from any script at both Runtime and in the Editor. Once loaded you can subscribe directly to theme change events allowing the theme manager system to be used though out your application. We have included setup tools and helper methods that can be used to setup and access the Addressables data.

Addressables Setup

To get started you will need to install Unity Addressables v2.9.1 or better from the package manager.
Once downloaded and installed you must open the Addressables Group Window from:

Windows -> Asset Management -> Addressables -> Group Window

Once opened you will be promted to create the Addressables Settings Asset, which is REQUIRED for our setup tools to function.

Activating the Window Framework Integration

We have added status indicators and an Addressables utility menu to the Theme Manager Window. once Addressables is installed the menu item will become enabled.

To activate Addressables Support follow these steps:

  1. Open the Theme manager Window
    Tools -> Garage-Ware Games -> Window Framework -> Theme Manager
  2. From the Addressables menu select Use Addressables
  3. From the Addressables menu select Setup Labels
    This will add the WindowFramework addressables group, marks the theme data files and add's the WindowFrameWork and ThemeData labels to the theme data files.
  4. From your Theme Data List
    (if you see individual themes, i.e. the data within your data file then click 'Clear Current' from the Theme manager toolbar.)
    Click the Addressables Default  button for the theme datafile you want to use when loading data using our helper methods.
All runtime Theme Lists and the Window Frame Controller will now load the theme data from addressables. You can see this in action by adding the ThemeSelectorElement to a UXML document in UI Builder. You will see the selected data displayed even in edit mode, then using the theme manager window change the selected addressable default and the list will be automatically updated.

Accessing Theme Data From Other Scripts

We have added a static helper class called: WindowFrameworkDataHelper.
Once Addressables is installed and setup, you can then use our helper methods to get the datafile from any script by using the following code sample:
// Accessing the Theme Data Using the Helper method
// This will return the WindowFrameworkThemeData scriptable object with the ACTIVE_THEME_DATA Addressables Label
WindowFrameworkThemeData ThemeData = await WindowFrameworkDataHelper.LoadAddressablesThemeDataAsync();

Then you can subscribe to the Theme Change events in the object and helper class:
// Get an updated datafile if changed
WindowFrameworkDataHelper.OnAddressablesThemeDefaultChanged += SetAddressablesThemeData;

// Get the updated theme when changed
ThemeData.OnThemeChanged += HandleThemeChanged; //remember to also unsubscripbe to save memory

We will be adding additional Addressables support features in future releases.