I'm trying to adjust the vignette attributes of a post-processing profile I've applied, but can't work out how to do this through script. In the old version, you had to declare a new post-processing profile, set the values and assign the new profile back to the existing. However, I can't seem to do this in the new version, and looking through the Unity manual mentions Manipulating the Stack and Writing Custom Effects, of which the AddSettings() method seemed the most promising. However, when I try blurProfile.AddSettings<Vignette>().intensity = new FloatParameter { value = 0 };
in the Start method, the value in the inspector remains unchanged.
How would I go about changing these attributes in script?
Since you are using the new Post-Processing Stack, you can access its components with the directive
using UnityEngine.Rendering.PostProcessing;
So for the Vignette you would use:
Vignette vignetteLayer = null;
vignetteLayer.intensity = new FloatParameter { value = 0 };
Check the official documentation for more information and also this question from the unity forums for more information about the new Post-Processing Stack