API

Assembly: Spark.GameSettings Interface: IGameSettingsPlugin Implementation: GameSettingsPlugin

Interface

public interface IGameSettingsPlugin
{
    // Video
    void SetResolution(int width, int height, FullScreenMode mode);
    int GetResolutionWidth();
    int GetResolutionHeight();
    void SetWindowMode(FullScreenMode mode);
    FullScreenMode GetWindowMode();
    void SetVSync(bool enabled);
    bool GetVSync();
    void SetFrameRateLimit(int limit);
    int GetFrameRateLimit();
    void SetQualityLevel(int level);
    int GetQualityLevel();
    void SetAntiAliasing(int level);
    int GetAntiAliasing();
    void SetTextureQuality(int quality);
    int GetTextureQuality();

    // Audio
    void SetVolume(AudioChannel channel, float volume);
    float GetVolume(AudioChannel channel);
    void SetAudioMixer(AudioMixer mixer);

    // Keybinds
    void RegisterInputActionAsset(InputActionAsset asset);
    void StartInteractiveRebind(string actionId, int bindingIndex,
        Action onComplete, Action onCancel);
    void CancelInteractiveRebind();
    void ResetBinding(string actionId, int bindingIndex);
    void ClearBinding(string actionId, int bindingIndex);
    void ResetAllBindings();
    string GetBindingDisplayString(string actionId, int bindingIndex);
    InputAction FindConflictingBinding(string bindingPath, string excludeActionId);

    // Persistence
    Task SaveSettingsAsync();
    void SaveSettings();
    Task LoadSettingsAsync();
    void ResetToDefaults();

    // Data access
    VideoSettingsData GetVideoSettings();
    AudioSettingsData GetAudioSettings();
    KeybindSettingsData GetKeybindSettings();
}

AudioChannel Enum

Save Data Classes

VideoSettingsData

Extends SaveDataEntry.

Field
Type
Description

resolutionWidth

int

Screen width in pixels

resolutionHeight

int

Screen height in pixels

windowMode

FullScreenMode

Fullscreen, windowed, or borderless

vSyncEnabled

bool

Vertical sync toggle

frameRateLimit

int

Max framerate (0 = unlimited)

qualityLevel

int

Unity quality settings index

antiAliasing

int

Anti-aliasing level

textureQuality

int

Texture resolution level

AudioSettingsData

Extends SaveDataEntry.

Field
Type
Description

masterVolume

float

Master volume in dB (-80 to 0)

musicVolume

float

Music volume in dB (-80 to 0)

sfxVolume

float

SFX volume in dB (-80 to 0)

uiVolume

float

UI volume in dB (-80 to 0)

KeybindSettingsData

Extends SaveDataEntry.

Field
Type
Description

assetOverrides

List<InputActionAssetOverride>

Per-asset rebind overrides

Each InputActionAssetOverride contains:

Field
Type
Description

assetGuid

string

GUID of the InputActionAsset

assetName

string

Human-readable asset name

overridesJson

string

Serialized rebind data

Events

Event
Description

KeybindChangedEvent

Published when a keybind is rebound

GameSettingsLoadedEvent

Published after settings are loaded from disk

Usage

Last updated

Was this helpful?