Search Unity

Edit Post Processing v2 on editor runtime

Discussion in 'Image Effects' started by TeohRIK, Apr 27, 2018.

  1. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    106
    Hi, as I know we are able to do runtime editing in editor with post processing v1, but seem like it doesn't work on Post Processing v2, is there any idea to edit it on editor runtime?
     
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
  3. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    Here's some code I use for debugging:

    Code (csharp):
    1. public class DebugGraphicsSettingsS : MonoBehaviour {
    2.  
    3.     [Header("Settings")]
    4.     public PostProcessVolume _volume;
    5.     private AmbientOcclusion _ao;
    6.     private ColorGrading _cg;
    7.  
    8.     void Start()
    9.     {
    10.          _volume.profile.TryGetSettings(out _ao);
    11.          _volume.profile.TryGetSettings(out _cg);
    12.     }
    13.  
    14.     // SSAO
    15.     public void SSAODefault()
    16.     {
    17.         _ao.enabled.value = true;
    18.         _ao.quality.value = AmbientOcclusionQuality.Medium;
    19.     }
    20.  
    21.     public void SSAOLow()
    22.     {
    23.         _ao.enabled.value = true;
    24.         _ao.quality.value = AmbientOcclusionQuality.Low;
    25.     }
    26.  
    27.     public void SSAOLowest()
    28.     {
    29.         _ao.enabled.value = true;
    30.         _ao.quality.value = AmbientOcclusionQuality.Lowest;
    31.     }
    32.  
    33.     // COLOR GRADING
    34.     public void ColorGradingOn()
    35.     {
    36.         _cg.enabled.value = true;
    37.     }
    38.  
    39.     public void ColorGradingOff()
    40.     {
    41.         _cg.enabled.value = false;
    42.     }
     
    Seith likes this.