using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; namespace Ashwild.Settings { [RequireComponent(typeof(Volume))] public class BrightnessController : MonoBehaviour { [SerializeField] private Volume volume; private ColorAdjustments colorAdjustments; private void Awake() { if (volume == null) volume = GetComponent(); if (volume != null && volume.profile != null) volume.profile.TryGet(out colorAdjustments); } private void OnEnable() { if (SettingsManager.Instance != null) SettingsManager.Instance.onSettingsChanged.AddListener(Apply); Apply(); } private void OnDisable() { if (SettingsManager.Instance != null) SettingsManager.Instance.onSettingsChanged.RemoveListener(Apply); } private void Apply() { if (colorAdjustments == null || SettingsManager.Instance == null) return; colorAdjustments.postExposure.value = (SettingsManager.Instance.Brightness - 1f) * 2f; } } }