Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

GUI.SelectionGrid

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public static function SelectionGrid(position: Rect, selected: int, texts: string[], xCount: int): int;
public static int SelectionGrid(Rect position, int selected, string[] texts, int xCount);
public static function SelectionGrid(position: Rect, selected: int, images: Texture[], xCount: int): int;
public static int SelectionGrid(Rect position, int selected, Texture[] images, int xCount);
public static function SelectionGrid(position: Rect, selected: int, content: GUIContent[], xCount: int): int;
public static int SelectionGrid(Rect position, int selected, GUIContent[] content, int xCount);
public static function SelectionGrid(position: Rect, selected: int, texts: string[], xCount: int, style: GUIStyle): int;
public static int SelectionGrid(Rect position, int selected, string[] texts, int xCount, GUIStyle style);
public static function SelectionGrid(position: Rect, selected: int, images: Texture[], xCount: int, style: GUIStyle): int;
public static int SelectionGrid(Rect position, int selected, Texture[] images, int xCount, GUIStyle style);
public static function SelectionGrid(position: Rect, selected: int, contents: GUIContent[], xCount: int, style: GUIStyle): int;
public static int SelectionGrid(Rect position, int selected, GUIContent[] contents, int xCount, GUIStyle style);

Parámetros

position Rectangle on the screen to use for the grid.
selected The index of the selected grid button.
texts An array of strings to show on the grid buttons.
images An array of textures on the grid buttons.
contents An array of text, image and tooltips for the grid button.
xCount How many elements to fit in the horizontal direction. The controls will be scaled to fit unless the style defines a fixedWidth to use.
style The style to use. If left out, the button style from the current GUISkin is used.

Valor de retorno

int The index of the selected button.

Descripción

Make a grid of buttons.

	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);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : 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); } }