Unity 6.3
0 онлайн 2 гостей 3 в системе
Вход

EditorGUI.RectField

Declaration

public static Rect RectField(Rect position, Rect value);
public static Rect RectField(Rect position, string label, Rect value);
public static Rect RectField(Rect position, GUIContent label, Rect value);

Параметры

Параметр Описание
должность Прямоугольник на экране, который будет использоваться для поля.
метка Необязательная метка, отображаемая над полем.
значение Значение для редактирования.

Возвращаемое значение

Прямая Значение, введенное пользователем.

Описание

Создает поля X, Y, W и H для ввода Rect.


Прямое поле в окне редактора.

using UnityEngine;
using UnityEditor;

// Find all the cameras in the Scene and shows all their viewports togheter

class EditorGUIRectField : EditorWindow { Camera[] cameras;

[MenuItem("Examples/Editor GUI RectField usage")] static void Init() { var window = GetWindow<EditorGUIRectField>(); window.position = new Rect(0, 0, 150, 120); window.Show(); }

void OnGUI() { if (GUI.Button(new Rect(3, 3, position.width - 6, 20), "Update list")) cameras = FindObjectsOfType<Camera>();

if (cameras.Length > 0) { for (var i = 0; i < cameras.Length; i++) { cameras[i].rect = EditorGUI.RectField( new Rect(3, 25 + 45 * i, position.width - 6, 25), cameras[i].name, cameras[i].rect); } } } }

Описание

Создаёт поля X, Y, W и H для Rect через SerializedProperty (не открытый метод).