AreaScope 区域范围

class in UnityEngine

Description 描述

Disposable helper class for managing BeginArea / EndArea.

管理BeginArea / EndArea的可支配的助手类。

BeginArea is called at construction, and EndArea is called when the instance is disposed. 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.

BeginArea 在结构中调用,并且当实例被配置时EndArea 被调用。默认情况下,任何GUI使用GUILayout 控制成功后被放置在屏幕的左上角位置。如果你想在任意区域放置一系列的自动布局控制,使用GUILayout.BeginArea去定义新的区域,使用自动布局系统。

Explained Area of the example.


no example available in JavaScript


using UnityEngine;


public class ExampleClass : MonoBehaviour {

    void OnGUI() {

		using (var areaScope =  GUILayout.AreaScope( Rect(10, 10, 100, 100))) {

	        GUILayout.Button("Click me");

    	    GUILayout.Button("Or me");




Constructors 构造函数

GUILayout.AreaScopeCreate a new AreaScope and begin the corresponding Area.