Skip to Content

UnityThemeAdapter

Service: Theme (Theme)
Code: Runtime/GnosisEngine/Adapters/Unity/Theme/UnityThemeAdapter.cs

Applies flattened theme values from GnosisThemeService / Persistent to Unity components. The service copies theme JSON onto Persistent when the theme id changes; this adapter polls the current id in Update and reapplies when it changes.

Inspector bindings

Serialized lists map a theme key (same string paths as on Persistent, e.g. color paths) to:

  • Image colors
  • TextMeshProUGUI colors
  • SpriteRenderer / MeshRenderer (material color)
  • Graphic (base class) colors

Supports alpha-only updates when the theme entry is alpha-only (see source: TryResolveThemeColor).

Public helpers

  • CurrentThemeId — Reads from the bound GnosisThemeService.
  • SetThemeId(string) — Calls SetThemeId on the service, then ApplyThemeFromData.
  • ForceRefresh() — Re-reads theme and reapplies bindings.

Editor

UnityThemeAdapterEditor (Editor/GnosisEngine/Permanent/Services/Theme/) — Inspector helpers for binding lists.

See also

  • Theme serviceSetCurrentTheme, FACT_THEME_CHANGED, JSON shape
Last updated on