Search Unity

[HDRP][2019.1] How Do You Change Effects Volume Overrides Through Script?

Discussion in 'High Definition Render Pipeline' started by Cinder, Apr 27, 2019.

  1. ozaneski13

    ozaneski13

    Joined:
    Oct 29, 2019
    Posts:
    9
    Greetings and sorry for necro.

    I am currently working on HDRP Volume profiles and I create Volume and add Depth Of Field to it via script and I can change Depth of Field values from script but can't see the effect on camera. When I change values from script can't see the new values at Depth of Field area until I move my cursor to Depth of Field area at editor. When I move it to area, values are changed but effect is not visible at game. I am not sure if it is a bug or not. Also SetDirty is deprecated, setting isDirty = true and setting DepthOfField.active = true didn't worked for me.

    Unity 2021.3.7f1
     
    Last edited: May 16, 2023
  2. ozaneski13

    ozaneski13

    Joined:
    Oct 29, 2019
    Posts:
    9
    UPDATE: https://forum.unity.com/threads/cant-see-changes-on-depthoffield.1437040/#post-9018826
     
  3. ronaldoUnited07

    ronaldoUnited07

    Joined:
    Mar 2, 2023
    Posts:
    9
    I am seeking advice on how to generate a day-night effect in a scene with an Interior House. I am currently rotating the direction light based on the time of day but am also using post-processing for better visual results. I was wondering if it is possible to change these values in runtime to generate the day-night effect or am heading in the wrong direction.
    here is the code that I used, It is changing the value but there is not affect in lighting.

    Code (CSharp):
    1.   public void OnDayNightTimeChangeRPC(SunRiseSet json) {
    2.             if (volumeProfile.TryGet(out HDRISky hDRISky)) {
    3.                 Debug.Log((json.azimuthAngle) + " : exposer");
    4.                 hDRISky.exposure = new FloatParameter((MathF.Abs((float)json.azimuthAngle) / 90) * 10, true);
    5.             }
    6. }
    upload_2023-7-21_12-7-8.png
     
    Last edited: Jul 21, 2023