GUILayout.Box 盒子

static function Box (image : Texture, params options : GUILayoutOption[]) : void
static function Box (text : string, params options : GUILayoutOption[]) : void
static function Box (content : GUIContent, params options : GUILayoutOption[]) : void
static function Box (image : Texture, style : GUIStyle, params options : GUILayoutOption[]) : void
static function Box (text : string, style : GUIStyle, params options : GUILayoutOption[]) : void
static function Box (content : GUIContent, style : GUIStyle, params options : GUILayoutOption[]) : void

Parameters参数

Description描述

Make an auto-layout box.

创建一个自动布局的box。

This will make a solid box. If you want to make a box with some contents inside, use the style paramenter of one of the subgroup functions (BeginHorizontal, BeginVertical, etc...).

这将创建一个实心盒体。如果你想创建一些内容在里面,使用分组函数的样式参数(BeginHorizontal, BeginVertical等)。

GUILayout.Box 盒子

Boxes in the Game View.

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Texture tex;
	void OnGUI() {
		if (!typeof(tex))
			Debug.LogError("Missing texture, assign a texture in the inspector");

		GUILayout.Box(tex);
		GUILayout.Box("This is an sized label");
	}
}
// Draws a texture and a label inside 2 different boxes
//绘制一个纹理和一个标签在两个不同的盒中
var tex : Texture;

function OnGUI() {
if(!tex) {
		Debug.LogError("Missing texture, assign a texture in the inspector");
	}
	GUILayout.Box(tex);
	GUILayout.Box("This is an sized label");
}
Page last updated: 2011-6-14