Foldout
示例程序 | |
---|---|
说明 | 生成一个左侧有展开箭头的标签,用于建立树形或文件夹类的组织结构 |
用法
public static bool Foldout(bool foldout, string content, bool toggleOnLabelClick, GUIStyle style = EditorStyles.foldout);
public static bool Foldout(bool foldout, GUIContent content, bool toggleOnLabelClick, GUIStyle style = EditorStyles.foldout);
public static bool Foldout(bool foldout, string content, GUIStyle style = EditorStyles.foldout);
public static bool Foldout(bool foldout, GUIContent content, GUIStyle style = EditorStyles.foldout);
参数
foldout
是否为展开状态。
content
要显示的标签。
style
(可选)由 GUIStyle
类型定义的 GUI 样式。
toggleOnLableClick
是否在点击标签时改变展开状态。
示例
public override void OnInspectorGUI () {
_show = EditorGUILayout.Foldout (_show, "Foldout Usage", true);
if (_show) {
_target.Position = EditorGUILayout.Vector3Field ("Postion", _target.Position);
}
}
编译结果如下: