Version: 2019.3

DisabledGroupScope

class in UnityEditor

マニュアルに切り替える

説明

BeginDisabledGroup と EndDisabledGroup で囲んだ GUI グループ内の GUI 要素を操作不可にする場合に使用されます。

disabledがtrueの場合は、グループ内のコントロールが無効になります。 falseの場合は、有効/無効の状態は変更されません。

The group cannot be used to enable controls that would otherwise be disabled to begin with. The groups can be nested and the controls within a child group will be disabled both if that child group is itself disabled or if a parent group is.

Note: For memory efficiency, the use of struct DisabledScope is preferred over class EditorGUI.DisabledGroupScope. Please refer to the DisabledScope documentation for more information.

using UnityEngine;
using UnityEditor;

public class ExampleClass : MonoBehaviour { bool canJump = false; float jumpHeight = 0f;

void Example() { canJump = EditorGUILayout.Toggle("Can Jump", canJump);

// Disable the jumping height control if canJump is false: EditorGUI.BeginDisabledGroup(canJump == false); jumpHeight = EditorGUILayout.FloatField("Jump Height", jumpHeight); EditorGUI.EndDisabledGroup(); } }

The group cannot be used to enable controls that would otherwise be disabled to begin with. The groups can be nested and the controls within a child group will be disabled both if that child group is itself disabled or if a parent group is.

コンストラクタ

EditorGUI.DisabledGroupScope新しい DisabledGroupScope を作成し、対応するグループを開始します。