文档库 最新最全的文档下载
当前位置:文档库 › unity3D教程之折叠标签

unity3D教程之折叠标签

unity3D教程之折叠标签
unity3D教程之折叠标签

static function Foldout (position : Rect, foldout : bool, content : string, style : GUIStyle = EditorStyles.foldout) : bool

static function Foldout (position : Rect, foldout : bool, content : GUIContent, style : GUIStyle = EditorStyles.foldout) : bool 【狗刨学习网】

Parameters参数

?position

Rectangle on the screen to use for the arrow and label.

屏幕上用于箭头和标签的矩形区域

?foldout

The shown foldout state.

显示折叠状态

?content

The label to show. // 显示标签

?style

Optional GUIStyle. // 可选GUIStyle样式

Returns

bool - The foldout state selected by the user. If true, you should render sub-objects.

返回布尔类型,用户选择的折叠状态,如果为真,应该渲染子对象。

Description描述

Make a label with a foldout arrow to the left of it.

制作一个左侧带折叠箭头的标签。

This is useful for creating tree or folder like structures where child objects are only shown if the parent is folded out.

这对于建立一个树或者文件夹很有用,就像一个结构,子对象只有在父对象展开时才显示

Foldout in an Editor Window.

在编辑器窗口中的折叠标签。

// Create a foldable menu that hides/shows the selected transform

// position.

//创建一个可折叠菜单隐藏/显示选择的变换位置

// if no Transform is selected, the Foldout item will be folded until // a transform is selected.

//如果没有变换被选中,折页将被折叠,直到变换被选择

class EditorGUIFoldout extends EditorWindow {

var showPosition : boolean = true;

var status : String = "Select a GameObject";

@MenuItem("Examples/Foldout Usage")

static function Init() {

var window = GetWindow(EditorGUIFoldout);

window.position = Rect(0, 0, 150, 60);

window.Show();

}

function OnGUI() {

showPosition =

EditorGUI.Foldout(Rect(3,3,position.width-6,15),showPosition, status);

if(showPosition)

if(Selection.activeTransform) {

Selection.activeTransform.position =

EditorGUI.Vector3Field(Rect(3,25,position.width -6 ,40),

"Position",

Selection.activeTransform.position);

status =

https://www.wendangku.net/doc/d011676247.html,;

}

if(!Selection.activeTransform) {

status = "Select a GameObject";

showPosition = false;

}

}

function OnInspectorUpdate() {

this.Repaint();

}

}

相关文档