Selectors
Horizontal Selector
Basically, think of this thing as a dropdown, but the navigation is managed by only with next and previous controls. In most cases, it’s more user (and controller) friendly.
![](https://docs.michsky.com/wp-content/uploads/2024/01/Unity_H9IY5zjJMJ.gif)
Localization
In order to use the localization system with selectors, you can select the object and assign a valid localization key for each ‘Key’ field. Everything will be handled automatically as long as the localization system is active.
![](https://docs.michsky.com/wp-content/uploads/2022/11/image_2022-12-26_212727087.png)
Scripting
using UnityEngine;
using Michsky.UI.Hex; // Namespace
public class SampleClass : MonoBehaviour
{
[SerializeField] private HorizontalSelector horSelector;
void HorizontalSelector()
{
// Set next or previous item
horSelector.NextItem();
horSelector.PreviousItem();
// Set specific item index and update the visuals
horSelector.index = 1;
horSelector.defaultIndex = 1;
horSelector.UpdateUI();
// Create or delete items
horSelector.CreateNewItem("New Item");
horSelector.RemoveItem("New Item");
// Process events based on the given index
horSelector.onValueChanged.Invoke(1);
// Process specific item event based on the given index
horSelector.items[1].onItemSelect.Invoke();
// Register a new event
horSelector.onValueChanged.AddListener(TestFunction);
}
void TestFunction(int value)
{
Debug.Log("Selector item selected: " + value);
}
}
How can we help?
A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.