Having realized that the Unity API source is present in the Reactional plugin, I was able to implement a suitable Setup.SwitchTheme method, which is basically the same as Setup.LoadTheme, but without the loading parts.
Not sure this is “the way,” but it works!
/// <summary>
/// Changes the active theme to a specific theme by its name from a given section and bundle.
/// </summary>
/// <param name="bundleName">The name of the bundle containing the theme.</param>
/// <param name="sectionName">The name of the section containing the theme.</param>
/// <param name="themeName">The name of the theme to load.</param>
public static async Task SwitchTheme(string bundleName, string sectionName, string themeName)
{
ReactionalManager rM = ReactionalManager.Instance;
Reactional.Core.Engine engine = ReactionalEngine.Instance.engine;
var bundle = rM.bundles.Find(x => x.name.Equals(bundleName));
var section = bundle.sections.Find(x => x.name.Equals(sectionName));
var theme = section.themes.Find(x => x.name.Equals(themeName));
if (theme == null)
{
ReactionalLog("Theme not found: " + themeName, LogLevel.Warning);
return;
}
// check if theme exists in loaded themes
if (rM._loadedThemes.Find(x => x.name == themeName) == null)
{
ReactionalLog("Theme not loaded: " + themeName, 0);
return;
}
ReactionalLog("Theme switch: " + themeName);
if (Playback.Theme.GetState() == Playback.MusicSystem.PlaybackState.Stopped)
engine.SetTheme(theme.ID);
await Task.Delay(200); // why 200?
}