Skip to content

SusSettingsContent ​

SusSettingsContent

Settings panel — volume slider, mute + dark-theme toggles, Apply / Back; persists via SusGameSettingsStore.

Package

SusGame · Screens (commercial)

Open in Playground

SusGame · Screens

Props

NameTypeDefault
ItemsProp<List<SusSettingItem>>[]v-modelfrom presets
PresentationProp<string>"screen"
TitleTextProp<string>"Settings"
ApplyTextProp<string>"Apply"
BackTextProp<string>"Back"
ChangedTextProp<string>"changed"

Slots

No slots.

Events

No public events.

Style hooks ​

USS class contract — override appearance without touching C#. States toggle via these classes:

  • sus-flow-settings-category
  • sus-flow-settings-category-row
  • sus-flow-settings-dropdown
  • sus-flow-settings-row
  • sus-flow-settings-row-head
  • sus-flow-settings-slider
  • sus-flow-settings-toggle
  • sus-flow-settings-value
  • sus-flow-settings-vol-label
  • sus-settings-content
  • sus-settings-content__column
  • sus-settings-content__column--last
  • sus-settings-content__columns
  • sus-settings-content__crumbs
  • sus-settings-content__head

Usage ​

The panel is data-driven: it builds one row per setting item (toggle, slider or dropdown) and reads/writes values through a store.

xml
<template>
  <sus:SusSettingsContent />
</template>
csharp
var settings = new SusSettingsContent();
settings.LoadFromStore();
settings.ApplyBtn.OnClick += () => settings.SaveToStore(themeRoot: null);
settings.BackBtn.OnClick += () => { /* dismiss */ };
Prop / APIRole
ItemsRows to show. null (default) = SusGameSettingsCatalog.DefaultItems followed by the registered rows
StoreValue store (ISusSettingsStore); the default adapter persists the stock rows and registered rows
Presentation"screen" (default) or "modal" (root modifier only)
TitleText / ApplyText / BackTextTitle and button labels. Defaults "Settings", "Apply", "Back"
ChangedTextPer-row "changed" badge. Default "changed"
ApplyBtn / BackBtnHost wiring
Volume / VolumeLabel / VolumeChip / Mute / DarkThemeLegacy handles to the stock rows' controls, filled when the rows are built (null while that row is not shown). Kept for existing host code; new code reads and writes values through Store
LoadFromStore() / SaveToStore(themeRoot)Pull values from the store / push them (theme via SetAndApplyTheme)
ResolvedItems()The rows the panel shows right now

Adding your own rows ​

SusGameSettingsCatalog.Register(item, get, set) adds an app-owned row without replacing Items. The default store reads the current value through get and writes the applied value through set; registering the same id again replaces the earlier row in place.

csharp
SusGameSettingsCatalog.Register(
    new SusSettingItem { Id = "subtitles", Label = "Subtitles", Kind = SusSettingKind.Toggle, Default = true },
    get: () => MySettings.Subtitles,
    set: v => MySettings.Subtitles = (bool)v);
  • With Items = null the panel shows the default rows (volume, mute, dark theme) followed by the registered rows. The default rows themselves cannot be registered.
  • Unregister(id) removes one row, ClearRegistered() removes them all.
  • The panel reads the catalog when it builds its rows, so register before the panel is shown.

Reduce motion row ​

SusGameSettingsCatalog.ReduceMotion is a stock toggle, off by default and opt-in: it is not part of DefaultItems. Show it with SusGameSettingsCatalog.RegisterReduceMotion() (it is then listed after the default rows) or put it into your own Items.

On load (LoadFromStore()) the default store restores only the application-wide SusMotion.Reduce flag; on Apply (SaveToStore(themeRoot)) it also adds or removes the sus-motion-reduce class on the theme root. Until the player has saved a choice, neither call touches the flag or the class. To have the class from the first frame, call SusGameSettingsStore.ApplyMotion(themeRoot) once the theme root exists. Kit and game components that loop pause or settle while the flag is on (spinners, indeterminate progress, text effects, parallax backdrops, the search radar sweep). Use the class to calm your own skin animations with one selector:

css
.sus-motion-reduce .my-skin__scanline {
    display: none;
}

Localized strings ​

Every visible default string of SusGame is an English literal, and the same literal is the key in a String Table Collection named SusGame (SusGameText.Table). The full list is SusGameText.Entries: use it as the checklist when you fill the table. Settings row and category labels are looked up by their Label, so your registered rows translate the same way.

  • Your value wins. A string prop you set yourself (for example TitleText = "Options") is never overwritten by a translation.
  • Missing table or entry = English. A string that has no translation keeps its English default.
  • Locale switch works live. Changing the selected locale re-translates bound strings.
  • Without Unity Localization (com.unity.localization not installed) the English defaults show. A project that has the Localization package but no Localization Settings keeps the English defaults too.

The key is the English text

Because the key is the English default itself, a future change to an English default is also a key change: the old table row stops matching and that string falls back to English. Compare your table with SusGameText.Entries after an update.

To bind your own component props the same way, use SusGameText.Bind(owner, (prop, "English text"), …) or, for other tables, SusLocalization.BindWhileAttached(owner, table, pairs) from SusKit.

Notes ​

  • Dark theme toggle applies on change (does not wait for Apply).
  • SaveToStore(null) resolves cascade root via SusThemeService.ResolveCascadeRoot(this).

Replacing custom workarounds ​

Custom workaroundBuilt-in API
Find the title by class and write the Apply/Back button textsTitleText / ApplyText / BackText + the SusGame table
Replace Items to add your own rowsSusGameSettingsCatalog.Register(item, get, set)
Your own store wrapper for a "reduce motion" keySusGameSettingsCatalog.RegisterReduceMotion() → SusMotion.Reduce, class sus-motion-reduce