Skip to content

VixSettings Setup

Namespace: VixSettings

Basic Workflow

  1. Create setting assets from Assets > Create > VixSettings > Setting.
  2. Create a SettingsRegistry from Assets > Create > VixSettings > SettingsRegistry.
  3. Add all setting assets to the registry.
  4. Create a storage asset, such as JsonSettingStorage.
  5. Add SettingsManager to a GameObject in the first loaded scene.
  6. Assign the registry and storage assets to SettingsManager.

SettingsManager is a singleton and uses DontDestroyOnLoad.

Creating Settings

Built-in setting asset types:

  • BoolSetting
  • IntSetting
  • FloatSetting
  • StringSetting
  • EnumSetting

Each setting has an ID. If the explicit ID field is empty, the asset name is used.

IDs must be unique within the SettingsRegistry.

Runtime Access

using VixSettings;

SettingsManager.Instance.SetValue("MasterVolume", 0.8f);

if (SettingsManager.Instance.TryGetSetting<float>("MasterVolume", out var volume))
{
    float currentVolume = volume.Value;
}

Listening for Changes

using UnityEngine;
using VixSettings.Settings;

public class VolumeListener : MonoBehaviour
{
    [SerializeField] private FloatSetting volume;

    private void OnEnable()
    {
        volume.ValueChanged += OnVolumeChanged;
        OnVolumeChanged(volume.Value);
    }

    private void OnDisable()
    {
        volume.ValueChanged -= OnVolumeChanged;
    }

    private void OnVolumeChanged(float value)
    {
        AudioListener.volume = value;
    }
}

Storage

SettingsManager only saves overridden values.

Built-in storage options:

  • JsonSettingStorage: saves setting overrides to a JSON file. Supports persistentDataPath, Documents, or a custom directory. Can pretty-print or compress data.
  • PlayerPrefsSettingStorage: saves setting overrides to PlayerPrefs with a configurable key prefix.

Appliers

Setting appliers listen to a setting and apply the value when it changes.

Built-in appliers include:

  • FullscreenApplier
  • MasterVolumeApplier
  • QualityLevelApplier

Use appliers when the setting should immediately affect Unity or project state.

Samples

The package includes a Basic Settings Menu sample that can be imported from Unity Package Manager.