- Home /
Question by
Cubemation · Mar 31, 2018 at 03:09 PM ·
5.3
How can i disable post-processing with a C# script ?
Hello. I'm trying to disable the post processing behaviour with a script, but it dosen't work. Here's the code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LowDetailToggle : MonoBehaviour {
// Dummy variable just to transfer an integer
public int LowDetail;
// Get the PostProcessingBehaviour script
private PostProcessingBehaviour PPB;
void Start () {
PPB = GetComponent<PostProcessingBehaviour>();
LowDetail = PlayerPrefs.GetInt("LowDetail"); // Check if Low Detail is enabled. If it's enabled, then
if (LowDetail > 0)
{
GetComponent<PPB>.enabled = false;
}
// If it's not, then do nothing
}
void Update () {
}
}
Comment
Answer by FlaSh-G · Apr 04, 2018 at 12:38 PM
GetComponent<PPB>
PPB is a variable, not a type, so this can't work. Also the term is missing the brackets ()
, so there's a syntax error. Try PPB.enabled = false;
instead.
Your answer

Follow this Question
Related Questions
5.3 32 bit editor missing Anroid module? 1 Answer
Scores Api with Facebook sdk 7.3 and Unity 5.3 1 Answer
Is it possible to run one scene in VR and separate camera angles of that scene on another monitor? 0 Answers
IsPointerOverGameObject bugs in 5.3 and newer. Workaround suggestions? 0 Answers
Unity 5.3.4: The type or namespace name `NUnit' could not be found. 1 Answer