How-To: Bind a Setting to Game Code

Goal: make a setting read from and write to a live game value (a volume, a quality preset, a subsystem property) the instant it changes - using the K2_BindSetting delegates.

Prerequisites
A data asset + registry (Quick Start). This path is for settings that drive live state; for plain persistence use the keyed store instead.

1. Handle K2_BindSetting

Populate From Data Asset fires K2_BindSetting once per created setting. Switch on DevName, cast to the value class, and bind its get/set delegates to your game functions.

In the registry Blueprint, use My Blueprint -> Functions -> Override and pick K2_BindSetting. Chain: K2_BindSetting -> Switch on Name (Selection = the event's Dev Name pin; add one output pin per setting you bind) -> Cast To CrimsonSettingValueScalar_BP (Object = the event's Setting pin).

From the cast result, drag off and use Bind Event to On Get Value and Bind Event to On Set Value, connecting each red delegate pin to a Custom Event - the first returns your game's current value, the second writes the new one. A discrete setting is the same shape against Cast To CrimsonSettingValueDiscrete_BP with Bind Event to On Get Index / On Set Index.

Value classDelegatePurpose
UCrimsonSettingValueScalar_BPOnGetValueRead the current value from game (returns double)
OnSetValueWrite the new value (double + ECrimsonSettingChangeReason)
OnGetFormattedTextOptional - custom display text
UCrimsonSettingValueDiscrete_BPOnGetOptionsReturn the option list (falls back to BPOptions)
OnGetIndexRead the current selection index
OnSetIndexWrite the new index (int32 + reason)
Verify
Dragging the slider calls your OnSetValue immediately; reopening the screen shows the game's current value via OnGetValue.
Unbound = internal storage
Leave a setting's delegates unbound and it stores its value internally (useful for a setting your game reads elsewhere). Tick Persist To Shared Store to also save that internal value across sessions.

See also

  • How-To: Persist Settings with Zero Glue - when you only need the value saved, not a live callback.
  • Concept: Value Types & Data Sources - delegates vs. C++ data sources vs. the keyed store.