Hotkey Event
Fires events based on given user input.
Workflow
There are two types of modes in this component.
- Custom: Fires events when the hotkey is triggered.
- Dynamic: Fires events when the hotkey is triggered and dynamically changes the indicator/UI.
You can see a screenshot of the dynamic mode below. You can use the create menu to create new dynamic hotkeys and select ‘Hotkey Indicator’ from the list.
The dynamic mode requires a default preset to work. As long as there’s a valid Controller Manager in the scene, this field will automatically be set.
In order to change the indicator UI, you must assign a valid Key ID. You can use the search bar to do this easily, as it will automatically search for the valid keys.
As long as localization or ‘Check For Localization’ options are disabled (available in the settings tab), ‘Hotkey Label’ will be used. If localization is enabled, the label will be set by ‘Localized Object’ which is attached to the same game object.
Scripting
using UnityEngine;
using Michsky.UI.Heat; // Heat UI namespace
public class SampleClass : MonoBehaviour
{
[SerializeField] private HotkeyEvent hotkeyEvent;
void Start()
{
// Set indicator label
hotkeyEvent.SetLabel("New Label");
// Apply the changes and update UI
hotkeyEvent.UpdateUI();
// Change the normal state opacity
hotkeyEvent.normalOpacity = 0.5f;
// Enable or disable sounds
hotkeyEvent.useSounds = true;
}
}
How can we help?
A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.