I am trying to access the Vignette Override and can find no way to do it. My Script has these in it:
using UnityEngine.Rendering.HighDefinition;
public GameObject PostObject;
public Vignette ActivePostVignette;
void FindPostVFX() // WE CREATED THIS FUNCTION
{
PostObject = GameObject.FindGameObjectWithTag("POST");
ActivePostVignette = PostObject.GetComponent<Vignette>();
}
But when I run it in the compiler “ActivePostVignette” is empty. It’s not finding the Vignette Override. And if I try to access the “Volume” Component, it tells me it doesn’t exist in the namespace. What am I missing???
Ok I tried changing the post effect through the profile and every other method that is currently online. How in the HECK do you modify these post effects in code???
It should work if your profile has already a vignette setting attached. This scripts assume you have already the reference of the volume profil you want to change.
if (globalVolumeProfile != null)
{
if (globalVolumeProfile.TryGet<Vignette>(out Vignette vignette))
{
vignette.intensity.value = 0.5f;
}
}