Toggle single post processing effect on/of with toggle

Can I turn on/off a single post processing effect like motion blur using a toggle?

I can only see a way to turn the entire post processing component on/off, not individual effects.

using UnityEngine.Rendering.PostProcessing;

public PostProcessVolume volume;

private Bloom bloom = null;
private ColorGrading colorgrading = null;
private DepthOfField dof = null;
private Vignette vignette = null;
private Grain grain = null;


void Start()
{
volume.profile.TryGetSettings(out bloom);
volume.profile.TryGetSettings(out colorgrading);
volume.profile.TryGetSettings(out dof);
volume.profile.TryGetSettings(out vignette);
volume.profile.TryGetSettings(out grain);
}

void EnableBloom(bool enabled)
{
bloom.enabled.value = enabled;
}
8 Likes

Thank you so much for your help and the script - I will try this out :slight_smile:

Thank You So Much :):):slight_smile:

Is this still valid?
I cant find

  • using UnityEngine.Rendering.PostProcessing;

Make sure to have the PostProcessing package installed from the package manager first ~

2 Likes

how do i disable
bloom.enabled.value = disabled; didn’t work

bloom.enabled.value = false;

Why you cant this?? 
    {
        float value = scrollbar.value;
        Bloom bloom = globalVolume.profile.components.OfType<Bloom>().First();//get bloom
        bloom.intensity.value = value;
        PlayerPrefs.SetFloat("Bloom", value);//saving
    } ```