public static Rect Window (int id, Rect screenRect, GUI.WindowFunction func, string text, params GUILayoutOption[] options);
public static Rect Window (int id, Rect screenRect, GUI.WindowFunction func, Texture image, params GUILayoutOption[] options);
public static Rect Window (int id, Rect screenRect, GUI.WindowFunction func, GUIContent content, params GUILayoutOption[] options);
public static Rect Window (int id, Rect screenRect, GUI.WindowFunction func, string text, GUIStyle style, params GUILayoutOption[] options);
public static Rect Window (int id, Rect screenRect, GUI.WindowFunction func, Texture image, GUIStyle style, params GUILayoutOption[] options);
public static Rect Window (int id, Rect screenRect, GUI.WindowFunction func, GUIContent content, GUIStyle style, params GUILayoutOption[] options);

Parameters

id@param id Уникальный идентификатор для использования каждого окна. Он используется для взаимодействия с окном.
screenRect@param screenRect Прямоугольник на экране для использования окна. Система позиционирования попытается заполнить окно, если не получится - оно будет заполнено простым прямоугольником.
func@param func Функция, создающая GUI внутри окне. Эта функция должна сдержать один параметр - идентификатор окна, для которого будет создавать GUI.
text@param text Текст, отображающийся в качестве заголовка окна.
image@param image Texture для отображения изображения в заголовке.
content@param content текст, изображение и подсказка для данного окна.
style@param style Настраиваемый стиль для использования окна. Если не указан, стиль окна будет взят из текущего GUISkin.
optionsAn optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style or the screenRect you pass in.
See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Rect @return Прямоугольник окна. Его размер и позиция может отличатся от того, который вы передали.

Description

Делает раскрывающееся окно, которое автоматически позиционирует контент.

Windows float above normal GUI controls, feature click-to-focus and can optionally be dragged around by the end user. Unlike other controls, you need to pass them a separate function for the GUI controls to put inside the window. Here is a small example to get you started:


Window in the Game View.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Rect windowRect = new Rect(20, 20, 120, 50); void OnGUI() { windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "My Window"); } void DoMyWindow(int windowID) { if (GUILayout.Button("Hello World")) print("Got a click"); } }

Прямоугольник экрана передается в функцию как руководство. Для применения дополнительных ограничений окну, передайте некоторые дополнительные опции. Те, которые применены здесь будут переопределять вычисление размера. Вот небольшой пример:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Rect windowRect = new Rect(20, 20, 120, 50); void OnGUI() { windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "My Window", GUILayout.Width(100)); } void DoMyWindow(int windowID) { if (GUILayout.Button("Please click me a lot")) print("Got a click"); } }