Объявление
public static int IntField(int value, params GUILayoutOption[] options);public static int IntField(int value, GUIStyle style, params GUILayoutOption[] options);
public static int IntField(string label, int value, params GUILayoutOption[] options);
public static int IntField(string label, int value, GUIStyle style, params GUILayoutOption[] options);
public static int IntField(GUIContent label, int value, params GUILayoutOption[] options);
public static int IntField(GUIContent label, int value, GUIStyle style, params GUILayoutOption[] options);
Параметры
label | Необязательная метка для отображения перед полем int. |
value | Значение для редактирования. |
style | Необязательный стиль GUIStyle. |
options | Необязательный список параметров макета, определяющих дополнительные свойства макета. Любые переданные здесь значения переопределяют настройки, заданные стилем .Смотрите так же: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight. |
Возвращает
int Значение, введенное пользователем.
Описание
Создаёт текстовое поле для ввода целых чисел.

// Редактор Скрипт, который несколько раз клонирует выбранный GameObject.
using UnityEditor;
using UnityEngine;
public class IntFieldExample : EditorWindow
{
int clones = 1;
static int sizeMultiplier;
[MenuItem("Examples/Clone Object")]
static void Init()
{
EditorWindow window = GetWindow(typeof(IntFieldExample));
window.Show();
}
void OnGUI()
{
sizeMultiplier = EditorGUILayout.IntField("Number of clones:", clones);
if (GUILayout.Button("Clone!"))
{
if (!Selection.activeGameObject)
{
Debug.Log("Select a GameObject first");
return;
}
for (var i = 0; i < sizeMultiplier; i++)
Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);
}
}
}