Skip to main content

SettingsFieldAccess

A class in Root.Township, Alta.Utilities.

Asset that ties a settings menu entry to one game or server setting, read and written by reflection in the generic subclass.

Constructors​

MemberWhat it is
SettingsFieldAccess()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

2 private and internal fields
MemberWhat it is
private string displayNameName shown for the setting. Backing field for DisplayName.
private SettingType settingTypeKind of setting, which picks the UI control. Backing field for SettingType.

Properties​

MemberWhat it is
string DisplayName { get; }Name shown in the settings menu.
virtual string SettingDescription { get; }Help text for the setting. Empty in the base class.
Settings Settings { get; set; }The settings object values are read from and written to.
SettingType SettingType { get; }The kind of control: toggle, scroll, enum, command and so on.
protected Action OnModifed { get; private set; }Called after a value is set. For game settings it notifies listeners and saves.

Methods​

MemberWhat it is
virtual bool IsValid()Whether the entry can be used. The generic version also needs the named property to exist.
void SetupFromGameSettings()Points the entry at the local game settings, saving them on every change.
void SetupFromServerSettings(ServerSettings settings)Points the entry at a server's settings. Changes aren't saved automatically.

Used in​

Members of other types that take, return or hold a SettingsFieldAccess: