EditorGUIUtility.LookLikeControls 像控件

static function LookLikeControls (labelWidth : float = 100, fieldWidth : float = 70) : void

Parameters参数

Description描述

Make all ref::EditorGUI look like regular controls.

使所有ref::EditorGUI看起来像标准控件。

This will make the default styles used by EditorGUI look like controls (e.g. EditorGUI.Popup becomes a full popup menu).

这将使默认样式使用于EditorGUI看起来像控件(例如EditorGUI.Popup成为一个完整的弹出菜单)

EditorGUIUtility.LookLikeControls 类似控件

Editor window with "LookLikeControls" look.

参见: LookLikeInspector

// Simple editor window that shows the difference between
// Look like controls and look like inspector
//编辑器窗口显示类似控件和类似检视面板的不同

class LookLikeControlsInspector extends EditorWindow {

	var integer1 : int = 0;
	var float1 : float = 5.5;

	@MenuItem("Examples/Look Like Controls - Inspector")
	static function Init() {
		var window = GetWindow(LookLikeControlsInspector);
		window.Show();
	}

	function OnGUI() {
		EditorGUIUtility.LookLikeInspector ();
			EditorGUILayout.TextField ("Text Field:", "Hello There");
			EditorGUILayout.IntField("Int Field:", integer1);
			EditorGUILayout.FloatField("Float Field:", float1);
		EditorGUILayout.Space();
		EditorGUIUtility.LookLikeControls();
			EditorGUILayout.TextField ("Text Field", "Hello There");
			EditorGUILayout.IntField("Int Field:", integer1);
			EditorGUILayout.FloatField("Float Field:", float1);
	}
}
最后修改:2011年7月15日 Friday 12:38

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。