Search Unity

How to change Post Processing Volume profiles via script?

Discussion in 'Scripting' started by DroidifyDevs, Jun 23, 2020.

  1. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    I'm simply trying to change this:
    upload_2020-6-23_15-40-0.png

    via c# script (I'm not even worried about making a smooth transition right now because I'm not sure how).

    From the docs, it seems like I should use UnityEngine.Rendering.PostProcessing, however, I'm getting an error:
    The type or namespace name 'PostProcessing' does not exist in the namespace 'UnityEngine.Rendering' (are you missing an assembly reference?).

    Why can't I use this namespace? I'm running Unity 2019.4.1 and Post Processing 2.3.0.

    Thank you!
     
  2. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    Hmm , im looking forward todo the same thing as you just mentioned,

    cant you get the component and access its Profile variable?

    im just gonna try it out right now , gonna let you know if it works! :)
     
  3. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    You can access it like so:

    Code (CSharp):
    1. using UnityEngine.Rendering;
    2.  
    3. public Volume postProcessing;
    4.  
    5. postProcessing.profile <---
     
    DroidifyDevs likes this.
  4. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Bro this is perfect!

    And I can declare public VolumeProfiles too, wooooooo!!!!
     
    valveCorpHype and Terraya like this.
  5. IchiroAlnairDev

    IchiroAlnairDev

    Joined:
    May 27, 2021
    Posts:
    1
    This thread is old, yes, but how to assign profiles?