EditorGUILayout.IntSlider 整数滑动条


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

Parameters参数

  • label
    Optional label in front of the toggle. // 开关按钮前面的可选标签。
  • value
    The value to edit. // 编辑的值
  • leftValue
    The value at the left end of the slider.
       滑动条最左边的值
  • rightValue
    The value at the right end of the slider.
       滑动条最右边的值
  • options
    An optional list of layout options that specify extra layouting   properties. Any values passed in here will override settings defined by   the style.  See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
       指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。

Returns

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

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

Description描述

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

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

Create a grid of cloned Objects.
创建一个复杂物体的表格。

// Simple editor script that lets you clone your object in a grid//使用滑动条表克隆物体class EditorGUILayoutIntSlider extends EditorWindow {var cloneTimesX : int = 1;var cloneTimesY : int = 1;var cloneTimesZ : int = 1;var spacing : int = 2;@MenuItem("Examples/Editor GUILayout IntSlider usage")static function Init() {var window = GetWindow(EditorGUILayoutIntSlider);window.Show();}function OnGUI() {cloneTimesX = EditorGUILayout.IntSlider(cloneTimesX, 1, 10);cloneTimesY = EditorGUILayout.IntSlider(cloneTimesY, 1, 10);cloneTimesZ = EditorGUILayout.IntSlider(cloneTimesZ, 1, 10);if(GUILayout.Button("Duplicate object"))CloneSelected();}function CloneSelected() {if(!Selection.activeGameObject) {Debug.LogError("Select a GameObject first");return;}for(var i = 0; i < clonetimesx;="" i++)="" for(var="" j="0;" j="">< clonetimesy;="" j++)="" for(var="" k="0;" k="">< clonetimesz;="" k++)="">Selection.activeGameObject,Vector3(i,j,k)*spacing,Selection.activeGameObject.transform.rotation);}}

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

Parameters参数

  • label
    Optional label in front of the toggle. // 开关按钮前面的可选标签。
  • property
    The value the slider shows. This determines the position of the draggable thumb.
       显示滑动条的值,可拖动滑块确定的位置。
  • leftValue
    The value at the left end of the slider.
       滑动条最左边的值
  • rightValue
    The value at the right end of the slider.
       滑动条最右边的值
  • options
    An optional list of layout options that specify extra layouting   properties. Any values passed in here will override settings defined by   the style.  See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
       指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。

Description描述

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

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


,