using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; /** * A custom class to handle dropdown related functions. */ public class DropdownMenuSetter { static string _value; public static void SetSelection(Dropdown dropdown, string value) { _value = value.Trim(); int idx = dropdown.options.FindIndex (matchName); // set the dropdown selection dropdown.value = idx; } static bool matchName(Dropdown.OptionData data) { return data.text.Equals (_value); } }