I'm trying to change the Chromatic Aberration override intensity on the URP Volume via code, but it doesn't seem to be working since the intensity on the volume doesn't change from 0.
Here's the code I'm using:
using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; public class PostProcessing : MonoBehaviour { public static PostProcessing instance; private Volume volume; private void Awake() { if (instance == null) instance = this; else if (instance != this) Destroy(this); } private void Start() { volume = GetComponent();
}
public void SetChromaticAbberationIntensity(float value)
{
ChromaticAberration ca;
if (volume.profile.TryGet(out ca))
{
ca.intensity = new ClampedFloatParameter(value, 0f, 1f);
Debug.Log($"Set ({ca}) to intensity {ca.intensity}");
}
}
}
I'm calling the SetChromaticAberrationIntensity() method on another script with the value increasing to 1 over time which seems to be functioning as intended. Here's 1 screenshot of the Debug.Log() in the console.
![alt text][1]
Thanks in advance! [1]: https://i.imgur.com/BBSjOpc.png
Here's the code I'm using:
using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; public class PostProcessing : MonoBehaviour { public static PostProcessing instance; private Volume volume; private void Awake() { if (instance == null) instance = this; else if (instance != this) Destroy(this); } private void Start() { volume = GetComponent
I'm calling the SetChromaticAberrationIntensity() method on another script with the value increasing to 1 over time which seems to be functioning as intended. Here's 1 screenshot of the Debug.Log() in the console.
![alt text][1]
Thanks in advance! [1]: https://i.imgur.com/BBSjOpc.png