Trying to toggle "motion blur" in Post processing layer on active camera

Here’s where I’m at.

using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class Options : MonoBehaviour
{
    MotionBlur blur;
    public PostProcessVolume currentPP;
    void Start()
    {
        blur = currentPP.GetComponent<MotionBlur>();
        blur.enabled.Override(true);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.B))
            if (blur.enabled) blur.active = false;
            else blur.active = true;
    }
}

I’d like to toggle motion blur on/off for the active post process volume but finding it more difficult than anticipated.

Not sure how to access the motion blur component of the layer.

Poked around here looking for an answer but didn’t really find a solution: Manipulating the Stack · Unity-Technologies/PostProcessing Wiki · GitHub

Any help is appreciated

When I’ve tried to modify post process volumes during game play I’ve been generally unsuccessful. What I went with was just putting anything I want to toggle on/off on its own post processing volume where I could disable the entire volume. I was using an earlier version of the V2 stack last I tried this though, so don’t know if this has been improved.

1 Like

Right on, this makes sense i’ll look into it!

1 Like