SettingDescriptor
public sealed class SettingDescriptorNamespace SideHustle
Added in 1.4.0
One host-configurable setting a gamemode exposes. Side Hustle renders these as a form on the Host screen, then ships the chosen values to the gamemode (host and clients) via the launch context’s config blob - see GamemodeDescriptor.HostSettings and MultiplayerInfo’s getters.
Every value is stored as a string under Key. Keep keys short (the whole blob rides on Steam lobby metadata) and stable (they are the wire format your gamemode reads back).
Stored form per Type: a Slider stores an integer such as “30” with WholeNumbers, else a number with up to two decimals such as “0.25”. Numbers use the invariant culture (a dot, no thousands separator). A Toggle stores “1” or “0”. Segmented and Dropdown store the chosen entry of Values, or of Options when Values is null. Text stores the typed text. The whole blob of all settings should stay under about 1500 bytes; a larger worst case logs a warning at API.Register.
Example
One setting per type, read back in the launch callback:
HostSettings = new[]{ new SettingDescriptor { Key = "len", Label = "Session length", Type = SettingType.Slider, Min = 10, Max = 120, Step = 10, WholeNumbers = true, Default = "30", Unit = "s" }, new SettingDescriptor { Key = "ping", Label = "Ping on start", Type = SettingType.Toggle, Default = "1" }, new SettingDescriptor { Key = "pace", Label = "Pace", Type = SettingType.Segmented, Options = new[] { "Slow", "Normal", "Fast" }, Values = new[] { "s", "n", "f" }, Default = "n" }, new SettingDescriptor { Key = "motd", Label = "Welcome text", Type = SettingType.Text, Default = "Have fun" }};// in OnHostMultiplayer / OnJoinMultiplayer:int seconds = ctx.Multiplayer?.GetInt("len", 30) ?? 30;Fields
Section titled “Fields”public string KeyAdded in 1.4.0
Stable, short id used to store/read the value (e.g. “round_time”). Required.
Value Unique within the gamemode, e.g. “len”. Compared exactly, case included. Null or empty skips the setting on the form. Read it back with MultiplayerInfo.GetSetting.
public string LabelAdded in 1.4.0
Label shown to the host. Required.
public string HintAdded in 1.4.0
Optional one-line help shown under the label.
Category
Section titled “Category”public string CategoryAdded in 1.5.0
Optional category name. The host form renders a section header whenever the category changes between consecutive settings, so order settings by category. Null/empty = no header for that setting.
public SettingType Type = SettingType.ToggleType: SettingType
Added in 1.4.0
The control to render.
Value Default SettingType.Toggle.
Default
Section titled “Default”public string DefaultAdded in 1.4.0
Default stored value (string form, parsed per Type).
Value Slider: a number in the invariant culture, e.g. “30”. Not a number starts at Min; a value outside Min..Max is clamped. Toggle: “1”, “0”, “true” or “false”; anything else starts off. Segmented and Dropdown: one of the stored values, e.g. “n”; anything else selects the first option. Text: the starting text. Null starts the slider at Min, the toggle off, the first option selected and the text empty.
public string UnitAdded in 1.4.0
Optional unit suffix shown next to a slider value (e.g. “s”, “m”, “players”).
public float Min = 0fAdded in 1.4.0
Slider minimum.
Value In the setting’s own unit, e.g. 10. Default 0. Above Max logs an error.
public float Max = 1fAdded in 1.4.0
Slider maximum.
Value In the setting’s own unit, e.g. 120. Default 1. Leaving the range at 0..1 logs a warning.
public float Step = 1fAdded in 1.4.0
Slider step/granularity (0 = continuous).
Value In the setting’s own unit, e.g. 10. Default 1. 0 or less means continuous, or steps of 1 with WholeNumbers. A negative step logs a warning.
WholeNumbers
Section titled “WholeNumbers”public bool WholeNumbersAdded in 1.4.0
When true the slider snaps to whole numbers (integer setting).
Options
Section titled “Options”public string[] OptionsAdded in 1.4.0
Segmented option labels (what the host sees).
Value Used by Segmented and Dropdown, e.g. new[] { "Slow", "Normal", "Fast" }. Null shows “Off” and “On”. An empty array logs an error and shows nothing.
Values
Section titled “Values”public string[] ValuesAdded in 1.4.0
Stored value per option, parallel to Options. When null the option label is stored.
Value Same length as Options, e.g. new[] { "s", "n", "f" }. Fewer entries store the label for the rest and log a warning. More entries log an error.