LogoLogo
What's new?StatusMSquared
  • Morpheus Platform Documentation
  • What is Morpheus Platform?
    • Glossary
    • Interoperability
    • Support
    • EULA
  • Firewall Problems
  • CREATION
    • Unreal Development
      • Get Started
        • Download the Editor
        • Upload Content
        • Creating your Own Map
        • Morpheus Base Project
        • Differences from Unreal
          • Character Configuration
        • Morpheus Networking
          • Introduction to Morpheus Networking
          • Network Levels
          • Replicated Properties
          • RPCs
          • Morpheus Render Targets
          • Morpheus Array
          • Networking FAQ
          • Replicating Sublevels
      • Editor Versions
      • Features & Guides
        • Example Plugin
          • Nameplates
          • In-Game Roles
          • Resizing
        • Actor Pooling
        • Audio
        • Avatars
          • Creating an Avatar
          • Attachments
            • MML Attachments
          • Custom Animation Variables
          • Importing an NFT Collection
          • Capsules and Mesh Transforms
        • Bots
        • Chat
          • Unreal Text Chat
        • Control Panels
          • Control Panel Configuration
          • DJ Booth Mission Control
          • Observer Controls
        • Crowd Audio
        • Crowd Rendering
          • Legacy Animated Crowd
            • Animated Crowd Console Commands
            • Attaching static meshes to crowd members
          • Crowd Materials
          • Performance Parameters
          • Live Config Settings
          • Crowd Animation
            • Crowd Anim Blueprint
              • User Guide - Crowd Anim Blueprint
              • Reference Guide - ABP Nodes
                • Animation Playback
                • States and State Machines
                • Variables
                • Transitions
                • Special
                • Blends
                • Additional Notes
        • Helpers & Extras
          • "Instanced Objects" in Blueprints
          • Objects with "world context"
          • Making DataAsset classes
          • Duplicate Objects
          • The Bootflow Subsystem
          • The "Wait For Condition" System
          • Advanced Graphics Settings
          • Listening to Inputs on UObjects
          • Morpheus UserID
          • World Services
          • M2Extras: Skins System
        • Loading Screen
        • Live Config
          • Editing for a World
          • Editing Locally
          • Default Settings
          • Accessing via Blueprint
          • Adding New Settings
          • Overriding Defaults
          • Using Arrays
        • MML
        • Motion Capture
        • Networking
        • Notifications
        • Raycastable Crowd
        • Singletons
        • Streaming & Multiplatform
          • GFN on Mobile
        • UI
          • "UI Mode"
        • User Collections
          • Creating a New Object Definition
          • Accessing from Unreal
            • Creating Objects Definitions
            • Transfer Objects
            • User Collection Views
            • Receiving Updates
        • Video Players
          • Embedded Video Player
          • Millicast video streaming
            • How to Setup an In-Game Video Stream
            • Picture-in-Picture mode
          • Streaming Video Player
            • How to Setup a URL Video Player
            • Picture-in-Picture mode
        • Visual Debugging
          • Inspector
        • Web UI
        • Online Services
          • KV Store Service
        • Web Requests
          • Http Requests
            • Legacy HTTP Nodes
          • JSON Handling
          • WebSockets
          • Identity Validation
          • Allowed External URLs
          • Walkthrough Example
            • Example Counter Service
        • World Travel
          • World Travel in the Editor
        • Avatar Physics Assets
        • Action Gameplay Helper Components
      • Workflows
        • Upgrade the Editor
        • Editing Project Settings
        • Profiling
        • Performance Guarantees
        • Marketplace Importing
        • Extra Workflows
          • Setup Play-in-Editor
          • Setup Local Asset Validation
          • Adding Gameplay Tags
          • Validating Game Assets
          • Custom Connection Modes
          • Connect Editor to a World
          • Common Issues
      • Best Practices
    • Worlds
      • Invite Players
        • Setting Role Groups
      • Persistent Worlds
      • Always on Worlds
    • Running Events
      • Large Scale Events - Checklist
      • Anti-Cheat (EAC)
      • Player Entry
        • React Native
        • Steam
        • Hardware Requirements
      • Broadcast
        • OBS Integration
      • Failover
      • Capacity and Queue Management
  • ADMINS
    • Access Control
      • Add Metaverse Contributors
      • Create a New Project
    • Pricing
      • Development Support
      • Included Usage & Overages
      • Cloud Streaming
      • Access Modes
      • War Room Support
      • Platform SLA
    • Settings
      • Projects
  • APIs and Tooling
    • API Reference
      • Accounts
      • Events
      • Key/Value Store
      • Organizations
      • Realtime
      • User Profile
      • World Builder
      • Worlds
    • Template Web App
      • Moderation
    • Pixel Streaming
    • Launcher
  • Integrations
    • Analytics
      • Send Events from Web
      • Send Events from Unreal
    • Chat
      • Integrate Pubnub with your Unreal Project
      • Add Moderation to Chat
Powered by GitBook
On this page
  • Overview
  • How to add
  • Live config
  • In WBP_M2_StandardButton /M2_StandardButtonData
  • In button lists
  • Updating the shortcut dynamically
  • Listening to "pressed" or "released"

Was this helpful?

  1. CREATION
  2. Unreal Development
  3. Features & Guides
  4. UI
  5. Standard/Data Driven UI

Keyboard Shortcuts in Standard Buttons

Last updated 8 months ago

Was this helpful?

Support for M2 Standard button will be ending soon. This system will remain usable for a while but MSquared advises that you implement your own widgets without the M2 Standard Button to avoid disruption.

Overview

NOTE: Standard UI keyboard shortcuts use Unreal's Enhanced Input system, and assumes knowledge of Input Actions, Triggers and Mapping Contexts - if you are unfamiliar with this, it would be best to read up on it first:

In the Standard UI system, we enable buttons to specify input actions that will act as clicking the button. If the button is enabled and on the screen, pressing the associated key will trigger the button.

This uses Input Icons to display shortcut keys for given input actions.

The buttons can either be assigned bespoke to a given button In WBP_M2_StandardButton /M2_StandardButtonData, or a set of keys can be automatically assigned In button lists.

Note that by default our buttons just listen to the Trigger event, and use that as "Button Clicked". If you want to use shortcut pressed/released events, see Listening to "pressed" or "released".

How to add

Live config

To enable/disable shortcuts in standard UI elements (e.g. the interaction menu and the gadgets' menus), you need the StandardUI.ShortcutsEnabled flag.

In WBP_M2_StandardButton /M2_StandardButtonData

If you have an individual M2_StandardButtonData that you want to assign a keyboard shortcut for (e.g if you are adding a WBP_M2_StandardButton directly to your screen), you can do so by setting the "Shortcuts" data within the object.

The fields are as follows:

  • ShortcutMappingContext and ShortcutAction:

    • These are required for specifying the "Enhanced Input" action and mapping used to identify what key should be pressed.

  • ShortcutIconLeftAligned:

    • This determines whether the shortcut icon appears on the left or the right of the button.

    • NOTE: If left-aligned, the icon is treated as a "visual attachment", so isn't treated as part of the widget when it comes to spacing or the like. This is so that we can have consistently aligned buttons in a list where some buttons don't have icons.

  • ShortcutPrioritizationName and ShortcutPrioritizationPriority:

    • These are optional fields you can add to make your shortcut use the Input Prioritization System (Input Prioritization).

    • (If you don't want to use the Input Prioritization System, leave ShortcutPrioritizationName as None)

    • Note: When using the input prioritization system, you need to make sure the inputs are set to not consume - that way we can listen to all the inputs, and handle them according to their priority

In button lists

If you have a list of buttons, which could have arbitrary buttons in them, but you want to assign a consistent set of shortcuts, you can configure this using the WBP_M2_StandardButtonList

The fields are as follows:

  • ShortcutMappingContext:

    • The mapping used for all the shortcuts in the list.

  • ShortcutActionList:

    • The actions we'll assign to the buttons in the list.

    • If we have more buttons than entries in the list, the surplus buttons won't have shortcut keys.

    • NOTE: If there are shortcuts already assigned in the button data in the list, one of two things will happen:

      • If the shortcuts are one of those already in this list, they will be overridden.

      • If the shortcuts are different actions, they will be ignored. (e.g. if you have actions for E, R, T and Y defined in your ShortcutActionList, but have a button data entry that specifies a "Left click" shortcut, that button will remain, and E, R, T and Y will be assigned to the other buttons in the list.

  • FlipList:

    • Means that we assign the shortcuts from the bottom up, rather than top down. You can use this if you want to have buttons follow a different order stylistically.

  • ShortcutPrioritizationName/ShortcutPrioritizationPriority/LeftAlignShortcutIcons: Same as for M2_StandardButtonData.

Updating the shortcut dynamically

From the button data, you can call UpdateShortcutInfo to update the shortcut info used, e.g. by supplying a new mapping context and input action, or removing the shortcut

Listening to "pressed" or "released"

To use Enhanced Input, we need to map the UI's "clicked", "pressed" and "released" events to Enhanced Input's "trigger types" (Started, Triggered, Ongoing, Canceled, Completed). This cannot be done in a one-size-fits-all way, since the triggers can occur in different ways depending on how the input action is configured.

(E.g. if your input action had no triggers defined, it would do Started = Press, Completed = Release, Triggered = called on tick whilst held. Conversely, if you have the Pressed trigger, then Started, Completed and Triggered are all called when the key is pressed).

By default, we have a single shortcut mapping, from Triggered to the "Clicked" event in the standard button. However, you can enable other events to trigger at the right time for your input action.

For example, the WBP_PartyChatButton uses an input action without a trigger, and instead uses Started and Completed for "pressed" and "released" respectively (but doesn't have a shortcut trigger for "clicked")

The relevant events are as follows:

  • OnActionButtonClicked

  • OnActionButtonPressed

  • OnActionButtonReleased

https://dev.epicgames.com/documentation/en-us/unreal-engine/enhanced-input-in-unreal-engine
The interaction menu for the "Device Vending Machine" here has keyboard shortcuts to activate the buttons with the num keys
This buttton uses IA_DeviceAction_Primary as a shortcut, listening to its Triggered event, which in this case occurs when the button is Pressed.
The "Exit Drone Cam Mode" button in this menu uses the IA_DroneCamBack action, which is mapped to the "R" key in IMC_DroneCamMode
The WBP_DeviceControlsWidget has a list of buttons, using the IMC_DeviceShortcuts mapping, where the first 4 buttons are assigned E (IA_DeviceShortcut1), R (IA_DeviceShortcut2) etc.
An exmple input action used by standard UI, with the "Pressed" trigger. This means that Triggered will be called when the mapped key is pressed.