Version: 2017.3
public static bool enabled ;

설명

Is the GUI enabled?

Set this value to false to disable all GUI interaction. All controls will be draw semi-transparently, and will not respond to user input.


Enabled / Disabled GUI controls.

using UnityEngine;
using System.Collections;

public class ExampleClass : 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"); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961