Replace the former per-value PlayerPrefs storage with a shared human-readable Settings.json store (GameSettings). MouseSensitivity keeps its public .Multiplier API and only swaps its backing to the JSON store, so the camera controllers stay untouched. Add a MasterVolume facade that drives the AudioMixer's exposed "MasterVolume" parameter (loaded from Resources, linear<->dB mapping), applied at startup and on change, plus a MasterVolumeSlider binder. The default is the level currently authored on the mixer instead of an arbitrary constant. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
598 B
C#
18 lines
598 B
C#
using UnityEngine;
|
|
|
|
/// Global mouse look-around sensitivity multiplier, shared by every camera
|
|
/// controller (FreeCam, FirstPerson, ThirdPersonOrbit). 1 = unchanged baseline.
|
|
/// Persisted via GameSettings (Settings.json) so the setting survives restarts.
|
|
public static class MouseSensitivity
|
|
{
|
|
public const float Default = 1f;
|
|
public const float Min = 0.1f;
|
|
public const float Max = 4f;
|
|
|
|
public static float Multiplier
|
|
{
|
|
get => Mathf.Clamp(GameSettings.MouseSensitivity, Min, Max);
|
|
set => GameSettings.MouseSensitivity = Mathf.Clamp(value, Min, Max);
|
|
}
|
|
}
|