- Home /
Option to toggle SSAO in game? [Solved]
Hello, I want to have an option on my pause menu and main menu to turn off some of the image effects in game. How would I go about doing this? The main one I want to have an option for is SSAO, so I'd like to start with that.
Comment
Best Answer
Answer by save · May 06, 2012 at 10:34 PM
Cache the component on the camera then enable or disable it.
#pragma strict
var cam : Camera;
private var ssao : SSAOEffect;
private var toggleSsao : boolean = true;
function Start () {
if (cam==null) cam = Camera.main;
ssao = cam.GetComponent(SSAOEffect);
}
function OnGUI () {
toggleSsao = GUI.Toggle(Rect(10, 10, 100, 30), toggleSsao, "SSAO");
if (GUI.Button(Rect(10,70,50,30),"Save")) {
ssao.enabled = toggleSsao;
}
}
Your answer
Follow this Question
Related Questions
ImageEffects-toggling through code issues 0 Answers
Unity 5.6 splash screen tool: Blurry background image 0 Answers
UFPS Simple Image Effect Script Help 0 Answers
BloomAndFlares Monodevelop compile error 0 Answers
Turn On and Off Lights Via Script 1 Answer