Version: 2022.3
言語: 日本語
public static int SelectionGrid (Rect position, int selected, string[] texts, int xCount);
public static int SelectionGrid (Rect position, int selected, Texture[] images, int xCount);
public static int SelectionGrid (Rect position, int selected, GUIContent[] content, int xCount);
public static int SelectionGrid (Rect position, int selected, string[] texts, int xCount, GUIStyle style);
public static int SelectionGrid (Rect position, int selected, Texture[] images, int xCount, GUIStyle style);
public static int SelectionGrid (Rect position, int selected, GUIContent[] contents, int xCount, GUIStyle style);

パラメーター

position グリッドを描画するスクリーン上の Rect
selected 選択したボタンのインデックスを返します
texts グリッドボタン上に表示する文字列配列
images グリッドボタン上に表示するテクスチャ配列
contents グリッドボタンのテキスト、画像、ツールチップとなる GUIContent 配列
xCount 水平に並べる要素の数。コントロールはスタイルに定義されている fixedWidth を使用しない限りフィットするように大きさが拡大縮小されます
style 使用するスタイル。省略された場合は、現在の GUISkin にある button スタイルを使用します。

戻り値

int 選択したボタンのインデックスを返します

説明

選択グリッドボタン

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() { // use 2 elements in the horizontal direction selGridInt = GUI.SelectionGrid(new Rect(25, 25, 100, 30), selGridInt, selStrings, 2); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961