Version: 2019.1
public static void BeginArea (Rect screenRect);
public static void BeginArea (Rect screenRect, string text);
public static void BeginArea (Rect screenRect, Texture image);
public static void BeginArea (Rect screenRect, GUIContent content);
public static void BeginArea (Rect screenRect, GUIStyle style);
public static void BeginArea (Rect screenRect, string text, GUIStyle style);
public static void BeginArea (Rect screenRect, Texture image, GUIStyle style);
public static void BeginArea (Rect screenRect, GUIContent content, GUIStyle style);

Parameters

text@param text Настраиваемый текст для отображения в области.
imageOptional texture to display in the area.
contentOptional text, image and tooltip top display for this area.
styleThe style to use. If left out, the empty GUIStyle (GUIStyle.none) is used, giving a transparent background.

Description

Назначает блок элементов управления GUILayout, управляемый в определенной области экрана.

By default, any GUI controls made using GUILayout are placed in the top-left corner of the screen. If you want to place a series of automatically laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.

See Also: EndArea


Explained Area of the example.

using UnityEngine;

public class ExampleScript : MonoBehaviour { void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 100, 100)); GUILayout.Button("Click me"); GUILayout.Button("Or me"); GUILayout.EndArea(); } }

Данная функция очень полезна при смешивании GUILayout кода. Он должен быть согласован с вызовом EndArea. BeginArea / EndArea не могут быть вложенными.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961