title: Setting up a UI slider to control post processing effects?
body: <p>As the title says, I'm trying to set up a UI slider so the player can adjust some of the post processing settings (specifically the exposure and temperature) while the game is running.</p>
  
  <p>To bring you up to speed:</p>
  
  <ul>
  <li>I'm using version one of the post processing stack, as found here:
  <a href="https://assetstore.unity.com/packages/essentials/post-processing-stack-83912" rel="nofollow noreferrer">https://assetstore.unity.com/packages/essentials/post-processing-stack-83912</a> </li>
  <li>I'm very new to C#; I'm at the "Frankenstein" stage of learning how to code (following tutorials and modifying what works until it breaks or does what I'm trying to accomplish).</li>
  </ul>
  
  <p>I figure my best shot is to try to adapt what I learned from this tutorial on creating an audio volume slider: <a href="https://www.youtube.com/watch?v=YOaYQrN1oYQ&amp;t=122s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=YOaYQrN1oYQ&amp;t=122s</a></p>
  
  <p>This is the code I've cobbled together so far:</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class BrightnessSlider : MonoBehaviour {
  
      public void SetBrightness (float brightness)
      {
          Debug.Log(brightness);
      }
  }
  </code></pre>
  
  <p>Specific issues I'm having at specific points in the tutorial:</p>
  
  <ul>
  <li>2:07 For the function of the slider, the tutorial sets up a dynamic float that matches the custom method (SetVolume) they specify. When I try setting up my own function with a custom method (SetBrightness), I can't find it. I'm also not sure if I need to set a different object instead of the canvas for this step.</li>
  <li>3:47 In the tutorial they expose a parameter for the volume so that it can be manipulated through script, but I don't know what the equivalent of that would be for post processing.</li>
  </ul>
  
  <p>For the record, I was able to follow this tutorial to create my own audio slider and got it working with no problems.</p>
  
  <p>One last thing: I opened up the script for the post processing profile and found the variable type I think I'd need or would at least be somewhat relevant: ColorGradingModel, but I honestly have no idea what to do with this information.</p>
  
  <p><strong>Update July 09, 2018</strong> </p>
  
  <p>  I've since been looking over @Nol's code and had someone else look at it and help me out with it. At the moment, the slider's functionality(not sure if that's the correct terminology but that's what I've been sticking with) is set up through the On Value Changed field in the inspector , but it's not actually driving/changing the brightness values. I had someone else (who's far more qualified than I am) look at it with me. It seems like it should work the way they've set it up, but something is getting lost in translation between the method and the slider.</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.PostProcessing;
  using UnityEngine.UI;
  
  public class BrightnessSlider : MonoBehaviour   
      {
      public Slider slider;
      public PostProcessingProfile Default;
      private ColorGradingModel cgm;
  
      private void Start()
      {
          //I haven't been able to get this to not return some sort of error, 
          //and I'm not even sure of its usefulness. 
          //I've been keeping it commented out for the most part.
          Default.profile.TryGetSettings(out cgm);
      }
  
      public void SetBrightness(float brightness)
      {
          ColorGradingModel.Settings settings = cgm.settings;
          settings.basic.postExposure = brightness;
          cgm.settings = settings;
          Debug.Log("Brightness is: " + brightness);  //For testing purposes
      }
  
  }
  </code></pre>