Lens Distortion does not do anything when changed through script

Heya everyone,

I usually try to figure everything out by myself, but this time I am pretty stuck on this one.

I’m trying to change the Lens Distortion in the volume stack through script but it doesn’t seem to do anything.

When I remove the modifier in the update loop and change the values by hand, everything works just fine.

The values get set and are applied on the volume post processing stack but for some reason I do not see any sort of change in the game view…

Here’s the code I’m using:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class ShaderControl : MonoBehaviour
{
    public GameObject PPStack;
    Volume ppvolume;
    public LensDistortion LD;
    public VolumeParameter VP;
    public VolumeProfile VolProf;
    float changeval = 0.0f;

    // Start is called before the first frame update
    void Start()
    {
        ppvolume = PPStack.GetComponent<Volume>();
        LensDistortion tmp;

        if (ppvolume.profile.TryGet(out tmp)) {
            LD = tmp;
        }
    }

    // Update is called once per frame
    void Update()
    {
        //LD.active = true;
        changeval -= 0.0002f;
        LD.intensity = new ClampedFloatParameter(changeval, -1f, 1f, true);
    }
}

Sorry if something similar has been answered before that I haven’t seen yet, but any sort of help would be greatly appreciated.

Best Regards

Debes usar:
changeval = 0.0002;

LD.scale.Override(changeval);
LD.intensity.Override(changeval);