SettingsFieldAccess<TFieldType>
An abstract class in Root.Township, Alta.Utilities.
An asset that reads and writes one named property of GameSettings or ServerSettings by reflection. Used by quick access menu and settings UI entries.
Constructors
| Member | What it is |
|---|
protected SettingsFieldAccess() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private string fieldName | Name of the public property on GameSettings or ServerSettings to read and write. |
private bool isServerSetting | If true the property is looked up on ServerSettings, otherwise on GameSettings. |
private PropertyInfo property | Cached reflected property. Backing field for Property. |
private string settingDescription | Description text for the setting. Backing field for SettingDescription. |
Properties
| Member | What it is |
|---|
override string SettingDescription { get; } | Description text set in the asset. |
protected PropertyInfo Property { get; } | The reflected property, looked up by field name on GameSettings or ServerSettings. Falls back to game settings if none were set. |
Methods
| Member | What it is |
|---|
virtual TFieldType GetValue() | Reads the property from the current settings object. |
override bool IsValid() | True if the named property exists on the settings type. |
virtual void SetValue(TFieldType value) | Writes the property, then (for game settings) notifies listeners and saves the game config. |