- Home /
Question by
Bluefni · Jun 26, 2017 at 09:27 AM ·
scripting problem
Changing post-processing profile via scripting
Can somebody tell me how I could change the profile of the unity's post-processing stack, via scripting. For example, when I press F I want to switch from normal camera profile to nightvision profile.
Comment
Best Answer
Answer by tanoshimi · Jun 26, 2017 at 10:24 AM
public PostProcessingProfile nightvisionProfile;
void Update () {
if(Input.GetKeyDown(KeyCode.F)) {
ppp = GetComponent<PostProcessingBehaviour>().profile = nightvisionProfile;
}
}
well, I also had to write: using UnityEngine.PostProcessing
Answer by daveblancas · Nov 24, 2021 at 10:10 PM
Updating the answer:
using UnityEngine.Rendering.PostProcessing;
public PostProcessingProfile profile;
Camera.main.GetComponent<PostProcessVolume>().profile = profile;
Your answer
![](https://koobas.hobune.stream/wayback/20220612124914im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Suspend script until keypress 2 Answers
i cant acces the navmesh surface 0 Answers
Having problems spawning an object via script c# 1 Answer
orienting player in one direction 1 Answer
Have an object only visible when input is held down 1 Answer