[Solved]Can't update color in GradientSky on post process volume by script

Hello community,

In HDRP’s Volume component, I want to lerp the color in gradient sky by script.

I have set the UpdateMode to “realtime” and the Update Period to “0”,

and here is my script:

  public GradientSky daySky;
    public Volume vol;

    void Start(){
        vol.profile.TryGet(out daySky);
    }

    void Update(){
  
         daySky.top.value = Color.Lerp(Color.white, Color.black, (Mathf.Sin(Time.time * 0.4f) + 1f) / 2f);

     }

I can see the “top color” is update in the inspector, but in the game scene nothing happen.

HDRP version 7.31

(PS: Update. The issue has solved when I update the HDRP version to 7.51)

I would love to help you, seeing that nobody replied, but frankly, I have zero experience with HDRP, so whatever I might tell you would likely mislead you.

Dumb question: Have you set the Sky type to Gradient Sky in Visual Environment panel?

Thank u. Yes. If I don’t use script. I can change the gradient color and it can affect the game scene

So it was a bug after all (after seeing your OP edit). I wanted to suggest it, but I wasn’t sure enough.