- Home /
Question by
janikboss · Aug 01, 2020 at 09:00 PM ·
c#postprocess
Any way to get and change current Post Processing profile via script?
Hi, guys!
I have been struggling to find a way to get and change current Post Process profile via script.
I have 2 profiles and what I basically want to do, is to change the current to the other one when a certain key is pressed and then check which profile is currently in use to change it back to the other one.
So is there any way? I am sure there is, but I am having a hard time finding it and putting my code together.
Thanks a lot!
Comment
Best Answer
Answer by Llama_w_2Ls · Aug 02, 2020 at 10:18 AM
You could just change the values of the post process volume instead of switching out profiles, but heres a solution
public PostProcessVolume volume;
public PostProcessProfile Profile1;
public PostProcessProfile Profile2;
private void Start()
{
volume = GameObject.Find("Volume").GetComponent<PostProcessVolume>();
//Finds the object in my scene with the post process volume on it
volume.profile = Profile1;
//Sets the profile of the PPVolume to Profile1
}
void ChangeProfiles() //When function is called, profiles are switched
{
if (volume.profile == Profile1)
volume.profile = Profile2;
else
volume.profile = Profile1;
}
Thanks, turned out to be a pretty easy solution and worked out great in the end! :)