private void AddUISelector(MixerCategory category) { string[] labels = LibraryAsset.GetCategoryLabelNames(category.name) .ToArray(); // Create new item & add it to the sidebar MixerSelector item = Instantiate(selectorTemplate, transform); // Initialize the item with options item.Init(category, labels); }
public void Init(MixerCategory category, string[] labels) { // Set title titleLabel.text = category.displayTitle; // Populate dropdown List <Dropdown.OptionData> spriteLabels = new List <Dropdown.OptionData>(); foreach (string label in labels) { Dropdown.OptionData data = new Dropdown.OptionData(label); spriteLabels.Add(data); } dropdown.options = spriteLabels; // Handle change dropdown.onValueChanged.AddListener(optionIndex => { string label = labels[optionIndex]; category.resolver.SetCategoryAndLabel(category.name, label); }); }