Selectors
using UnityEngine;
using Michsky.UI.Heat; // Heat UI 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);
}
}
C#