Version: 2017.4
public void AddOptions (List<OptionData> options);

パラメーター

options追加する OptionData のリスト

説明

OptionData オブジェクトのリストに基づいてドロップダウンのオプションに複数のオプションを追加します。


public void AddOptions (List<string> options);

パラメーター

options追加するテキストの文字列のリスト

説明

複数のテキストのみのオプションを文字列のリストに基づいてドロップダウンのオプションに追加します。

Add a List of string messages to the Dropdown. The Dropdown shows each member of the list as a separate option.

//Create a new Dropdown GameObject by going to the Hierarchy and clicking Create>UI>Dropdown. Attach this script to the Dropdown GameObject.

using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;

public class Example : MonoBehaviour { //Create a List of new Dropdown options List<string> m_DropOptions = new List<string> { "Option 1", "Option 2"}; //This is the Dropdown Dropdown m_Dropdown;

void Start() { //Fetch the Dropdown GameObject the script is attached to m_Dropdown = GetComponent<Dropdown>(); //Clear the old options of the Dropdown menu m_Dropdown.ClearOptions(); //Add the options created in the List above m_Dropdown.AddOptions(m_DropOptions); } }

public void AddOptions (List<Sprite> options);

パラメーター

options追加するスプライトのリスト

説明

スプライトのリストに基づいてドロップダウンのオプションを複数の画像専用のオプションを追加します。