言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

GUI.enabled

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static var enabled: bool;
public static bool enabled;
public static enabled as bool

Description

GUIが有効かどうか

すべてのGUIインタラクションを無効にするにはこの値をfalseにします。すべてのコントロールが半透明になり、ユーザーの入力を受け付けません。
有効 / 無効 にしたGUIコントロール

	// The value tracking whether or not the extended options can be toggled.
	var allOptions : boolean = true;
	// The 2 extended options.
	var extended1 : boolean = true;
	var extended2 : boolean = true;
	function OnGUI () {
		// Make a toggle control that allows the user to edit some extended options.
		allOptions = GUI.Toggle (Rect (0,0,150,20), allOptions, "Edit All Options");
	
		// Assign the value of it to the GUI.enabled - if the checkbox above
		// is disabled, so will these GUI elements be
		GUI.enabled = allOptions;
		
		// These two controls will only be enabled if the button above is on.
		extended1 = GUI.Toggle (Rect (20,20,130,20), extended1, "Extended Option 1");
		extended2 = GUI.Toggle (Rect (20,40,130,20), extended2, "Extended Option 2");
		
		// We're done with the conditional block, so make GUI code be enabled again.
		GUI.enabled = true;
		
		// Make an Ok button
		if (GUI.Button (Rect (0, 60, 150, 20), "Ok"))
			print ("user clicked ok");
	}
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");
        
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public allOptions as bool = true

	public extended1 as bool = true

	public extended2 as bool = true

	def OnGUI() as void:
		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')