Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to disable/enable post processing effects via script

Discussion in 'Scripting' started by FedeStefan, May 28, 2020.

  1. FedeStefan

    FedeStefan

    Joined:
    Aug 15, 2018
    Posts:
    221
    Hey guys, im trying to make a toggle that can enable or disable post processing effects via script.
    Any help? I tried doing it but it didn't work
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,713
  3. FedeStefan

    FedeStefan

    Joined:
    Aug 15, 2018
    Posts:
    221
    i only wanted to know how to disable or enable post processing effects via a toggle T_T
     
  4. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,904
    We have 4 different post processing system at the moment (pp1 and pp2 for the built in and two built in the URP and HDRP), which one? What have you tried so far, show us!
     
    exiguous likes this.
  5. FedeStefan

    FedeStefan

    Joined:
    Aug 15, 2018
    Posts:
    221
    I have tried PP2 with the standard pipe line. Heres what i tried doing
    Code (CSharp):
    1.         private void BlurChanged(bool isOn)
    2.         {
    3.             motionblur.enabled.value = enabled;
    4.             Save();
    5.         }
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,713
    That is AWESOME! Now... if you had a problem with it not working, review my post above:

    - what did YOU expect it to do exactly
    - what did/does it do EXACTLY
    - describe (using proper unity terms) what you have set up and connected together
    - using Debug.Log() to print values, what have YOU found out? Is the code called? Is the value on or off? etc.

    After having made eight (8!!!) separate posts about this, you have still obstinately refused to give us anything that can help us help you.
     
    Last edited: May 29, 2020
    Olmi and Lurking-Ninja like this.
  7. FedeStefan

    FedeStefan

    Joined:
    Aug 15, 2018
    Posts:
    221
    I expect it to turn off or on the post processing effect
    It didn't do anything
    I made a post processing volume with all the effects that the script has.
    I will try using debug.log

    I have not made 8 posts, 3 posts, 3, Where did you see 8 posts?
     
  8. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Yeah that is the behavior I mentioned I saw in one of your other 3 (8 :p ) threads. I'd still suggest creating a specific motion blur only post processing volume, and try enabling/disabling the entire volume. You can have multiple volumes running at the same time, and they will combine their effects. Don't include motion blur in any of the other active post processing volumes to make is easier to verify it is working.
     
  9. FedeStefan

    FedeStefan

    Joined:
    Aug 15, 2018
    Posts:
    221
    So i make post processing profiles and each has only one effect and then i go the script and disable/activate the post processing profiles that has the effect motion blur or bloom?
     
  10. wlad_s

    wlad_s

    Joined:
    Feb 18, 2011
    Posts:
    148