static function BeginArea (screenRect : Rect) : void
static function BeginArea (screenRect : Rect, text : string) : void
static function BeginArea (screenRect : Rect, image : Texture) : void
static function BeginArea (screenRect : Rect, content : GUIContent) : void
static function BeginArea (screenRect : Rect, style : GUIStyle) : void
static function BeginArea (screenRect : Rect, text : string, style : GUIStyle) : void
static function BeginArea (screenRect : Rect, image : Texture, style : GUIStyle) : void
static function BeginArea (screenRect : Rect, content : GUIContent, style : GUIStyle) : void
Description描述
Begin a GUILayout block of GUI controls in a fixed screen area.
在一个固定的屏幕区域,开始一个GUI控件的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.
默认,使用GUILayout创建的任意GUI控件,放置在屏幕的左上角。如果你想在任意区域放置一系列自动布局控件,使用GUILayout.BeginArea定义新的区域,为自动布局系统使用。
Explained Area of the example.
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnGUI() {
GUILayout.BeginArea(new Rect(200, 200, 100, 100));
GUILayout.Button("Click me");
GUILayout.Button("Or me");
GUILayout.EndArea();
}
}
function OnGUI () {
// Starts an area to draw elements
//在开始区域中创建元素
GUILayout.BeginArea (Rect (200,200,100,100));
GUILayout.Button ("Click me");
GUILayout.Button ("Or me");
GUILayout.EndArea ();
}
This function is very useful when mixing GUILayout code. It must be matched with a call to EndArea. BeginArea / EndArea cannot be nested.
当混合布局代码这个函数是非常有用的,它必须匹配调用EndArea来结束。BeginArea / EndArea不能嵌套。