GUILayout.SelectionGrid 选择表格

static function SelectionGrid (selected : int, texts : string[], xCount : int, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, images : Texture[], xCount : int, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, content : GUIContent[], xCount : int, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, texts : string[], xCount : int, style : GUIStyle, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, images : Texture[], xCount : int, style : GUIStyle, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, contents : GUIContent[], xCount : int, style : GUIStyle, params options : GUILayoutOption[]) : int

Parameters参数

Returns

int - The index of the selected button.

返回整数型,被选择按钮的索引。

Description描述

Make a Selection Grid

创建一个选择表格。

GUILayout.SelectionGrid 选择表格

Selection grid in the Game View.
在游戏视图中的选择表格。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public int selGridInt = 0;
	public string[] selStrings = new string[] {"Grid 1", "Grid 2", "Grid 3", "Grid 4"};
	void OnGUI() {
		selGridInt = GUILayout.SelectionGrid(selGridInt, selStrings, 2);
	}
}
var selGridInt : int = 0;
var selStrings : String[] = ["Grid 1", "Grid 2", "Grid 3", "Grid 4"];

function OnGUI () {
	selGridInt = GUILayout.SelectionGrid (selGridInt, selStrings, 2);
}
最后修改:2011年6月14日 Tuesday 14:54

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。