Set this value to false to disable all GUI interaction. All controls will be draw semi-transparently, and will not respond to user input.
var allOptions : boolean = true;
var extended1 : boolean = true;
var extended2 : boolean = true;
function OnGUI () {
allOptions =
GUI.Toggle (
Rect (0,0,150,20), allOptions,
"Edit All Options");
GUI.enabled = allOptions;
extended1 =
GUI.Toggle (
Rect (20,20,130,20), extended1,
"Extended Option 1");
extended2 =
GUI.Toggle (
Rect (20,40,130,20), extended2,
"Extended Option 2");
GUI.enabled = true;
if (
GUI.Button (
Rect (0, 60, 150, 20),
"Ok"))
print (
"user clicked ok");
}
using UnityEngine;
using System.Collections;
public class example :
MonoBehaviour {
public bool allOptions = true;
public bool extended1 = true;
public bool extended2 = true;
void OnGUI() {
allOptions =
GUI.Toggle(
new Rect(0, 0, 150, 20), allOptions,
"Edit All Options");
GUI.enabled = allOptions;
extended1 =
GUI.Toggle(
new Rect(20, 20, 130, 20), extended1,
"Extended Option 1");
extended2 =
GUI.Toggle(
new Rect(20, 40, 130, 20), extended2,
"Extended Option 2");
GUI.enabled = true;
if (
GUI.Button(
new Rect(0, 60, 150, 20),
"Ok"))
print(
"user clicked ok");
}
}
import UnityEngine
import System.Collections
class example(
MonoBehaviour):
public allOptions as
bool = true
public extended1 as
bool = true
public extended2 as
bool = true
def
OnGUI():
allOptions =
GUI.Toggle(
Rect(0, 0, 150, 20), allOptions, 'Edit All Options')
GUI.enabled = allOptions
extended1 =
GUI.Toggle(
Rect(20, 20, 130, 20), extended1, 'Extended Option 1')
extended2 =
GUI.Toggle(
Rect(20, 40, 130, 20), extended2, 'Extended Option 2')
GUI.enabled = true
if GUI.Button(
Rect(0, 60, 150, 20), 'Ok'):
print('user clicked ok')