how to modify post processing via sceript in unity code example
Example 1: how to edit postprocessing through script
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
var volume = target.GetComponent<Volume>();
if (volume.profile.TryGet<Bloom>(out var bloom))
{
bloom.intensity.overrideState = true;
bloom.intensity.value = 2f;
}
Example 2: urp set postprocessing value
UnityEngine.Rendering.VolumeProfile volumeProfile = GetComponent<UnityEngine.Rendering.Volume>()?.profile;
if(!volumeProfile) throw new System.NullReferenceException(nameof(UnityEngine.Rendering.VolumeProfile));
UnityEngine.Rendering.Universal.Vignette vignette;
if(!volumeProfile.TryGet(out vignette)) throw new System.NullReferenceException(nameof(vignette));
vignette.intensity.Override(0.5f);