In 2022.1 I used the way below to change the preset, but it doesn’t seem to work anymore. While the preset value itself does change in the inspector, it doesn’t load the preset’s values.
Has there changed something or is my project bugged? Or is it a general bug even?
public void setCloudPreset(int i)
{
VolumeProfile profile = globalVolume.sharedProfile;
profile.TryGet<VolumetricClouds>(out var clouds);
VolumetricClouds.CloudPresetsParameter cp = clouds.cloudPreset;
cp.value = (VolumetricClouds.CloudPresets)i;
}
So I have made a new project with a global volume with volumetric clouds and attached this script, but it still doesn’t work:
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
public class test : MonoBehaviour
{
void Start()
{
VolumeProfile profile = GetComponent<Volume>().sharedProfile;
profile.TryGet<VolumetricClouds>(out var clouds);
clouds.cloudPreset.value = (VolumetricClouds.CloudPresets) 2;
}
}
It changes the preset from Sparse to Overcast, but the parameters don’t change:
So how to do it now or is it a bug? Then I can submit it.
I filed a bug report which is now under investigation.
As a workaround I now use a game object for every cloud preset and just enabled/disable the objects. Works also fine
1 Like