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 

Hex UI

  • Quick Start
  • Animations
  • Controller & Input
    • Controller Manager
    • Controller Presets
    • Hotkey Event
    • UI Navigation
  • Handlers & Managers
    • Audio
    • Chapters
    • Credits
    • Effects
    • In-Game
  • Localization
    • Getting Started
    • Localization Settings
    • Localization Manager
    • Localized Object
  • UI Elements
    • Button
    • Dropdown
    • Modal Window
    • Notifications
    • Panel Manager
    • Progress Bar
    • Selectors
    • Slider
    • Switch
    • Timer
    • Widgets
    • Others
  • UI Manager
  • Others & Add-ons
  • FAQs
  1. Home
  2. Hex UI
  3. UI Elements
  4. Dropdown
Updated on May 19, 2024

Hex UI

  • Quick Start
  • Animations
  • Controller & Input
    • Controller Manager
    • Controller Presets
    • Hotkey Event
    • UI Navigation
  • Handlers & Managers
    • Audio
    • Chapters
    • Credits
    • Effects
    • In-Game
  • Localization
    • Getting Started
    • Localization Settings
    • Localization Manager
    • Localized Object
  • UI Elements
    • Button
    • Dropdown
    • Modal Window
    • Notifications
    • Panel Manager
    • Progress Bar
    • Selectors
    • Slider
    • Switch
    • Timer
    • Widgets
    • Others
  • UI Manager
  • Others & Add-ons
  • FAQs

Dropdown

Author: admin 46 views

Workflow

This element works similarly to the native dropdown in terms of events, but has many additional functions as well as an easy o use preset system. In order to change the dropdown item preset, you can simply select the ‘Item Preset’ prefab and make changes.

Localization

In order to use the localization system with dropdowns, you can select the object and assign a valid localization key for each dropdown item. Everything will be handled automatically as long as the localization system is active.

Scripting

				
					using UnityEngine;
using Michsky.UI.Hex; // Namespace

public class SampleClass : MonoBehaviour
{
    // You may have to specify Michsky.UI.Reach in some cases
    [SerializeField] private Michsky.UI.Reach.Dropdown dropdown;

    void Start()
    {
        // Sets the dropdown index and updates the layout
        dropdown.SetDropdownIndex(0);

        // Process the event based on the given item index
        dropdown.onValueChanged.Invoke(0);

        // Register a new dynamic event
        dropdown.onValueChanged.AddListener(TestFunction);

        // Set the interaction state
        dropdown.Interactable(true);

        // Create a new item
        dropdown.CreateNewItem("Item Name");

        // Create a new item but do not initialize the component
        // Use this with (e.g. for, foreach)
        dropdown.CreateNewItem("Item Name", false);

        // Remove the item
        dropdown.RemoveItem("Item Name");

        // Remove the item but do not initialize the component
        // Use this with loops (e.g. for, foreach)
        dropdown.RemoveItem("Item Name", false);

        // Initialize the component
        // Use this after creating or removing items within a loop
        dropdown.Initialize();
    }

    void TestFunction(int value)
    {
        Debug.Log("Dropdown item selected: " + value);
    }
}				
			

How can we help?

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

© 2024 Michsky