public static int IntPopup (int selectedValue, string[] displayedOptions, int[] optionValues, params GUILayoutOption[] options);
public static int IntPopup (int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options);
public static int IntPopup (int selectedValue, GUIContent[] displayedOptions, int[] optionValues, params GUILayoutOption[] options);
public static int IntPopup (int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options);
public static int IntPopup (string label, int selectedValue, string[] displayedOptions, int[] optionValues, params GUILayoutOption[] options);
public static int IntPopup (string label, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options);
public static int IntPopup (GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, params GUILayoutOption[] options);
public static int IntPopup (GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options);

Parameters

label(可选)字段前的标签。
selectedValue该字段显示的选项的值。
displayedOptions供用户选择的所示选项的数组。
optionValues具有每个选项值的数组。
style可选 GUIStyle
options一个可选的布局选项列表,用于指定额外的布局属性。此处传递的任何值都将覆盖 style 定义的设置。
另请参阅:GUILayout.WidthGUILayout.HeightGUILayout.MinWidthGUILayout.MaxWidthGUILayout.MinHeightGUILayout.MaxHeightGUILayout.ExpandWidthGUILayout.ExpandHeight

Returns

int 用户所选选项的值。

Description

创建一个整数弹出选择字段。

以参数形式获取当前所选的整数,并返回用户选择的整数。


Rescales the current selected GameObject.

// Simple Editor Script that lets you rescale the current selected GameObject.
using UnityEditor;
using UnityEngine;

public class IntPopupExample : EditorWindow { int selectedSize = 1; string[] names = new string[] {"Normal", "Double", "Quadruple"}; int[] sizes = {1, 2, 4};

[MenuItem("Examples/Int Popup usage")] static void Init() { EditorWindow window = GetWindow(typeof(IntPopupExample)); window.Show(); }

void OnGUI() { selectedSize = EditorGUILayout.IntPopup("Resize Scale: ", selectedSize, names, sizes); if (GUILayout.Button("Scale")) ReScale(); }

void ReScale() { if (Selection.activeTransform) Selection.activeTransform.localScale = new Vector3(selectedSize, selectedSize, selectedSize); else Debug.LogError("No Object selected, please select an object to scale."); } }

Obsolete public static void IntPopup (SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues, GUIContent label, GUIStyle style, params GUILayoutOption[] options);
public static void IntPopup (SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues, params GUILayoutOption[] options);
public static void IntPopup (SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues, GUIContent label, params GUILayoutOption[] options);

Parameters

property该字段显示的选项的值。
displayedOptions供用户选择的所示选项的数组。
optionValues具有每个选项值的数组。
label(可选)字段前的标签。
options一个可选的布局选项列表,用于指定额外的布局属性。此处传递的任何值都将覆盖 style 定义的设置。
另请参阅:GUILayout.WidthGUILayout.HeightGUILayout.MinWidthGUILayout.MaxWidthGUILayout.MinHeightGUILayout.MaxHeightGUILayout.ExpandWidthGUILayout.ExpandHeight

Description

创建一个整数弹出选择字段。