Michsky – Docs Michsky – Docs
  • Home 
  • Documentation 
    • Hex UI 
    • Beam UI 
    • Reach UI 
    • Heat UI 
    • DreamOS 
    • Modern UI Pack 
    • Loading Screen Studio 
    • Dark UI 
    • Motion Titles Pack 
  • Contact 
Michsky – Docs Michsky – Docs
Michsky – Docs
  • Home 
  • Documentation 
    • Hex UI 
    • Beam UI 
    • Reach UI 
    • Heat UI 
    • DreamOS 
    • Modern UI Pack 
    • Loading Screen Studio 
    • Dark UI 
    • Motion Titles Pack 
  • Contact 

Modern UI Pack

  • Quick Start
  • How To (FAQs)
  • UI Elements
    • Button
    • Charts
    • Context Menu
    • Dropdown
    • Horizontal Selector
    • List View
    • Modal Window
    • Movable Window
    • Notification
    • Progress Bar
    • Slider
    • Switch
    • Tooltip
    • Window Manager
    • Other Elements
  • UI Manager
  • Others & Add-ons
  1. Home
  2. Modern UI Pack
  3. UI Elements
  4. Horizontal Selector
Updated on August 3, 2022

Modern UI Pack

  • Quick Start
  • How To (FAQs)
  • UI Elements
    • Button
    • Charts
    • Context Menu
    • Dropdown
    • Horizontal Selector
    • List View
    • Modal Window
    • Movable Window
    • Notification
    • Progress Bar
    • Slider
    • Switch
    • Tooltip
    • Window Manager
    • Other Elements
  • UI Manager
  • Others & Add-ons

Horizontal Selector

Author: admin 171 views

Basically, think of this thing as a dropdown, but the navigation is managed by only with next and previous controls.

Items

You can add horizontal selector items to this list. If you wish, you can add functions to each item as well. As long as ‘Indicator’ is enabled, each button will generate an indicator item at runtime.

Saving

You can save the selected value by enabling this feature. Note that every selector should has its own unique Selector Tag value. Otherwise, there might be conflict(s) between selectors.

Properties

Property Type Function

enableIndicators

bool

Enables or disables item indicators.

invokeAtStart

bool

Process onValueChanged events at start when enabled.

index

int

Returns the currently selected item index.

onValueChanged

UnityEvent

Process dynamic events on item/value changed.

Scripting

				
					using UnityEngine;
using Michsky.MUIP; // MUIP namespace

public class SampleClass : MonoBehaviour
{
    public HorizontalSelector mySelector; // Your selector variable

    void YourFunction()
    {
        mySelector.CreateNewItem("Item Title"); // Creating a new item
        mySelector.CreateNewItem("Item Title", SpriteVariable); // Creating a new item with icon

        // Creating items within a loop
        for (int i = 0; i < yourIndexOrVariable; ++i)
        {
            mySelector.CreateNewItem("Item Title");
        }

        // Adding a new dynamic event
        mySelector.onValueChanged.AddListener(TestFunction);

        // Initializing the selector - required after creating a new item
        mySelector.defaultIndex = 3; // optional
        mySelector.SetupSelector();

        // Changing index & updating UI manually
        mySelector.index = 3;
        mySelector.UpdateUI();

        mySelector.NextItem(); // Select next item
        mySelector.PreviousItem(); // Select previous item
        mySelector.RemoveItem("Item Title"); // Delete a specific item
    }

    void TestFunction(int value)
    {
        Debug.Log("Changed index to: " + value.ToString());
    }
}				
			

How can we help?

A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.

© 2024 Michsky