With the new Unity HDRP the skybox and environment settings from the lighting bar have disappeared and made way for a different way to tackle these, with the Volume Settings gameobject.
Is there a way to call the rotation value from this gameobject in code? I mean the rotation knob thing not the game object rotation itself as it would just rotate the gameobject and not the skybox itself.
public Volume volume;
private HDRISky hdriSky;
private float hdriRotationSpeed = 20;
private float rotation = 0;
void Start() {
volume.profile.TryGet(out hdriSky);
}
void Update()
{
if(Input.GetMouseButton(1)) {
if(Input.GetKey(KeyCode.LeftAlt)) {
float angle = Input.GetAxis("Mouse X") * hdriRotationSpeed;
rotateHDRI(angle);
}
}
}
private void rotateHDRI(float angle) {
rotation += angle;
while(rotation > 360) {
rotation -= 360;
}
while(rotation < 0) {
rotation += 360;
}
hdriSky.rotation.Override(rotation);
//hdriSky.rotation.value = rotation;
}
With this script you can rotate the hdrisky by pressing right mouse button + left alt and moving the mouse. hdriSky.rotation.value = rotation; does not work for me, but i saw it in other answers to same questions.