I’ve been looking for this for a while but I can’t find an answer, how would I edit individual values in a post processing profile in a script? I want to be able to toggle and edit values from something like Chromatic Abbreviation, but I can’t find any way of doing so. For something so simple and important you’d think this would be easier to find but I can’t find anything. Please help me!
1 Answer
1you’ll need to add this to your code:
using UnityEngine.Rendering.PostProcessing;
then you’re able to editing a postprocessprofile as you want to!
EDIT, @IgnitedGames added a more detailed Example of how you can change values of the PPP with c#:
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
public class PostProcessing_UnityAnswers : MonoBehaviour
{
public PostProcessProfile PP_Profile;
public Texture2D SpectralLut;
[Range(0,1)]public float Intensity = 0;
public bool FastMode = false;
void Update()
{
if(PP_Profile != null){
ChromaticAberration ca = null;
PP_Profile.TryGetSettings(out ca);
ca.spectralLut.value = SpectralLut;
ca.intensity.value = Intensity;
ca.fastMode.value = FastMode;
}
}
}
PostProcessing apparently doesn't exist, adding that to my code gives me this error: > The type or name "PostProcessing" does not exist in the namespace "UnityEngine.Rendering". (Are you missing an assembly reference?)
– IgnitedGamesNew problem, I can't figure out how to edit the profiles. Apparently they only return values and I can't set them.
– IgnitedGames