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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

HDRI Sky swap by code in HDRP?

Discussion in 'Graphics Experimental Previews' started by Lorca1031, Sep 14, 2018.

  1. Lorca1031

    Lorca1031

    Joined:
    May 4, 2018
    Posts:
    10
    Hey there, I would like to know how I can change the HDRI sky through code at runtime. Please let me know if you have any idea.
     
  2. Lorca1031

    Lorca1031

    Joined:
    May 4, 2018
    Posts:
    10
    I figured it out! :D You can make a separate Volume profiles and swap em out via code like this

    Code (CSharp):
    1. public UnityEngine.Experimental.Rendering.VolumeProfile profile;
    2.     UnityEngine.Experimental.Rendering.Volume Volume { get { return FindObjectOfType<UnityEngine.Experimental.Rendering.Volume>(); }}
    3.  
    4. void Start()
    5. { Volume.profile = profile; }
     
  3. RoyLin86

    RoyLin86

    Joined:
    Aug 30, 2016
    Posts:
    12
    Hey,I've got the same problem. Is this work with unity 2019 series?It seems that there is no more Volume value in UnityEngine.Experimental.Rendering.How can I change the value via code?
    Thank you.