Recently I added HDRP inside my project. After I figured out how to implement the skybox I wanted to make it rotate and change between night and day skybox. So I tried to add a script on the skybox object but I was not able to add a reference on the Volume(script) component. Any suggestions on how to control my HDRI sky?
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
public class volume_control : MonoBehaviour
{
[SerializeField] Volume volume;
HDRISky sky;
public Cubemap sky_1, sky_2;
private void Start()
{
volume.profile.TryGet(out sky);
}
private void FixedUpdate()
{
/// ROTATE HDRI SKYBOX
sky.rotation.value += 0.02f;
}
private void Update()
{
change_skybox();
}
public void change_skybox()
{
if (Input.GetKeyDown("1"))
{
/// CHANGE HDRI SKYBOX
sky.hdriSky.value = sky_1;
}
else if (Input.GetKeyDown("2"))
{
sky.hdriSky.value = sky_2;
}
}
}