EditorGUI.LabelField
Declaration
public static void LabelField(Rect position, string label, GUIStyle style = EditorStyles.label);public static void LabelField(Rect position, GUIContent label, GUIStyle style = EditorStyles.label);public static void LabelField(Rect position, string label, string label2, GUIStyle style = EditorStyles.label);public static void LabelField(Rect position, GUIContent label, GUIContent label2, GUIStyle style = EditorStyles.label);Параметры
| Параметр | Описание |
|---|---|
| должность | Прямоугольник на экране, который будет использоваться для поля метки. |
| метка | Метка перед полем метки. |
| label2 | Метка для отображения справа. |
| стиль | Информация о стиле (цвет и т.д.) для отображения метки. |
Описание
Создает поле метки. (Применимо для отображения информации только для чтения.)
Показывает метку в окне редактора с секундами с момента запуска редактора.
// Shows a label in the editor with the seconds since the editor started
using UnityEditor; using UnityEngine; using System.Collections;
//Select the dependencies of the found GameObject public class EditorGUIObjectField : EditorWindow { [MenuItem("Examples/EditorGUI Label Usage")] static void Init() { UnityEditor.EditorWindow window = GetWindow(typeof(EditorGUIObjectField)); window.Show(); }
void OnGUI() { EditorGUI.LabelField(new Rect(3, 3, position.width, 20), "Time since start: ", EditorApplication.timeSinceStartup.ToString()); this.Repaint(); } }