static function SelectionGrid (position : Rect, selected : int, texts : String[], xCount : int) : int
static function SelectionGrid (position : Rect, selected : int, images : Texture[], xCount : int) : int
static function SelectionGrid (position : Rect, selected : int, content : GUIContent[], xCount : int) : int
static function SelectionGrid (position : Rect, selected : int, texts : String[], xCount : int, style : GUIStyle) : int
static function SelectionGrid (position : Rect, selected : int, images : Texture[], xCount : int, style : GUIStyle) : int
static function SelectionGrid (position : Rect, selected : int, contents : GUIContent[], xCount : int, style : GUIStyle) : int
int - The index of the selected button.
返回int类型,被选择按钮的索引号。
Description描述
Make a grid of buttons.
创建一个网格按钮。
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 = GUI.SelectionGrid(new Rect(25, 25, 100, 30), selGridInt, selStrings, 2);
}
}
var selGridInt : int = 0;
var selStrings : String[] = ["Grid 1", "Grid 2", "Grid 3", "Grid 4"];
function OnGUI () {
selGridInt = GUI.SelectionGrid (Rect (25, 25, 100, 30), selGridInt, selStrings, 2);
}