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. Context Menu
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

Context Menu

Author: admin 247 views

Simple yet functional pop-up menu which opens with a right click (hold on mobile). It only requires a manager (Context Menu Manager) to work, which was already created in the ready to use scene(s). To use it, you can simply add ‘Context Menu Content’ to any of your UI object, assign ‘Button Item’ (Context Menu Button) and ‘Context Manager’ fields.

Items

You can add context items to this list, change its name, icon or add events.

Properties

Property Type Function

mainCanvas

Canvas

Initializes the system depending on the rendering mode.

isOn

bool

Returns the context menu state.

Scripting

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

public class SampleClass : MonoBehaviour
{
    [SerializeField] private ContextMenuManager myContextMenu; // Variable
    void YourFunction()
    {
        myContextMenu.Open(); // Open menu
        myContextMenu.Close(); // Close menu
    }
}				
			
				
					using UnityEngine;
using Michsky.MUIP; // MUIP namespace

public class SampleClass : MonoBehaviour
{
    [SerializeField] private ContextMenuContent myContent; // Variable
    void YourFunction()
    {
        myContent.contexItems[1].itemText = "New Text"; // Change item text in given index
        myContent.contexItems[1].itemIcon = SpriteVariable; // Change item text in given index
        myContent.contexItems[1].onClick.AddListener(TestFunction); // Add new event in given index
        myContent.ProcessContent(); // Process all the changes
    }

    void TestFunction()
    {
        Debug.Log("Clicked");
    }
}				
			

How can we help?

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

© 2024 Michsky