EditorGUILayout.Slider 滑动条

static function Slider (value : float, leftValue : float, rightValue : float, params options : GUILayoutOption[]) : float
static function Slider (label : string, value : float, leftValue : float, rightValue : float, params options : GUILayoutOption[]) : float
static function Slider (label : GUIContent, value : float, leftValue : float, rightValue : float, params options : GUILayoutOption[]) : float

Parameters参数

Returns

float - The value that has been set by the user.

返回浮点数,由用户设置的值。

Description描述

Make a slider the user can drag to change a value between a min and a max.

制作一个滑动条用户可以拖动来改变值,在最小和最大值之间。

EditorGUILayout.Slider 滑动条

Scale the selected object between a range.
在一个范围缩放选择的物体。

// Editor script that lets you scale the selected GameObject between 1 and 100
//缩放选择的游戏物体,在1-100之间
class EditorGUILayoutSlider extends EditorWindow {

	var scale : float = 0.0;

	@MenuItem("Examples/Editor GUILayout Slider usage")
	static function Init() {
		var window = GetWindow(EditorGUILayoutSlider);
		window.Show();
	}

	function OnGUI() {
		scale = EditorGUILayout.Slider(scale,1, 100);
	}
	function OnInspectorUpdate() {
		if(Selection.activeTransform)
			Selection.activeTransform.localScale = Vector3(scale, scale, scale);
	}
}

static function Slider (property : SerializedProperty, leftValue : float, rightValue : float, params options : GUILayoutOption[]) : void
static function Slider (property : SerializedProperty, leftValue : float, rightValue : float, label : string, params options : GUILayoutOption[]) : void
static function Slider (property : SerializedProperty, leftValue : float, rightValue : float, label : GUIContent, params options : GUILayoutOption[]) : void

Parameters参数

Description描述

Make a slider the user can drag to change a value between a min and a max.

制作一个滑动条用户可以拖动来改变值,在最小和最大值之间。

最后修改:2011年7月13日 Wednesday 8:23

本脚本参考基于Unity 3.4.1f5

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