Quantcast
Channel: Questions in topic: "post processing"
Viewing all articles
Browse latest Browse all 713

Changing URP Volume values in code not working

$
0
0
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

Viewing all articles
Browse latest Browse all 713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>