I’m trying to add a brightness/gamma slider. I’ve succeeded in modifying the values, but it doesn’t actually change the game’s brightness. Based on what I’ve read, it sounds like there may be an instance that I’m not actually grabbing? Here’s the code I’m using right now:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
public class UserSettings : MonoBehaviour
{
private UnityEngine.Rendering.VolumeProfile volumeProfile;
private UnityEngine.Rendering.HighDefinition.LiftGammaGain gamma;
private void Start()
{
volumeProfile = GetComponent<UnityEngine.Rendering.Volume>()?.profile;
if (!volumeProfile) throw new System.NullReferenceException(nameof(UnityEngine.Rendering.VolumeProfile));
if (!volumeProfile.TryGet(out gamma)) throw new System.NullReferenceException(nameof(gamma));
}
public void AdjustGamma(float value)
{
gamma.gamma.value = new Vector4(value, value, value, 0);
}
}
Any suggestions? For reference, I’m using HDRP 7.3.1 and Unity 2019.4