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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question What is the correct way of changing the post-processing profile values at runtime?

Discussion in 'High Definition Render Pipeline' started by LukaKotar, Feb 20, 2020.

  1. LukaKotar


    Sep 25, 2011
    I am changing the Depth Of Field focal distance at runtime, but I'm doing so by modifying the profile asset itself, which doesn't seem right.

    Here's what I have right now:

    Code (CSharp):
    1. public VolumeProfile profile;
    2. DepthOfField dof;
    4. void Start(){
    5.     profile.TryGet<DepthOfField>(out dof);
    6. }
    I then set the value like so:

    Code (CSharp):
    1. dof.focusDistance.value = someFloat;
    Is this fine, or should I avoid doing it this way? If not, how should this be done?