Version: 2020.1
public static bool ToggleLeft (Rect position, string label, bool value, GUIStyle labelStyle= EditorStyles.label);
public static bool ToggleLeft (Rect position, GUIContent label, bool value, GUIStyle labelStyle= EditorStyles.label);

参数

position 屏幕上用于开关的矩形。
label 显示在开关旁的标签。
value 要编辑的值。
labelStyle (可选)用于标签的 GUIStyle

返回

bool 用户设置的值。

描述

创建一个开关字段,其中开关位于左侧,标签紧随其右。

EditorGUI.ToggleLeftGUI.Toggle 类似,但遵循 EditorGUI.showMixedValue 属性并处理与其他编辑器控件一致的键盘焦点。