Hey there! I’m currently trying to refer to the physically based sky script to change the rotation of the space.
Anyone knows how could I do that?
Hey I wanted to do the same thing and the only way I’ve found is this one:
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
Volume nightVolume;
PhysicallyBasedSky nightSky;
//where needed, access it like this
if (nightVolume.sharedProfile.TryGet(out nightSky))
{
Vector3 current = nightSky.spaceRotation.value;
current.z += Time.deltaTime * spaceRotationSpeed;
nightSky.spaceRotation.value = current;
}
Be sure to get the ‘sharedProfile’ of the volume, otherwise it looks like using ‘profile’ will return a copy.
If it’s possible, it might be a good idea to cache it instead of calling the TryGet() everytime…
I’ve found this method in this thread: https://forum.unity.com/threads/hdrp-2019-1-how-do-you-change-effects-volume-overrides-through-script.668842/
I am trying this method out, but at the if statement, I get the error “NullReferenceException: Object reference not set to an instance of an object” in unity. I am running 2021.3.3f1 incase version is important.