Hi, I searched the Internet but I can’t find a clean, complete and working script example allowing me to change the exf cubemap from a HDRi Sky.
Can someone help me ?
Hi, I searched the Internet but I can’t find a clean, complete and working script example allowing me to change the exf cubemap from a HDRi Sky.
Can someone help me ?
OK I managed to get what I needed.
public Volume skybox;
public HDRISky sky;
void Start()
{
if (skybox.profile.TryGet<HDRISky>(out HDRISky tmpOut))
{
sky = tmpOut;
}
if (sky != null)
{
CubemapParameter cbParam;
Texture2D tmpTexture = StringToTexture("HDRi", "snowy_field_19k");
// sky.hdriSky.Override(tmpTexture);
}
}
I was trying to access directly the hdriSky CubeMap. But there’s a simpler way using profiles
public class HDRIScript : MonoBehaviour
{
public Volume skybox;
public VolumeProfile test;
// Start is called before the first frame update
void Start()
{
skybox.profile = test;
}
}
And it works great !
like this