FunctionKey
Determines whether the current key press is a function key.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Field
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
FunctionKey = 64
Remarks
Function keys include the arrow keys, backspace, page up/down, as well as most non-printable keys.
Additional Resources: Event.functionKey.
Examples
using UnityEngine;using UnityEngine.UIElements;[RequireComponent(typeof(UIDocument))]public class Example : MonoBehaviour{ // Detects if a function Key was pressed. If a // function key was pressed, prints its key code. void OnEnable() { var textField = new TextField(); textField.RegisterCallback<KeyDownEvent>(e => { if ((e.modifiers & EventModifiers.FunctionKey) != 0) { Debug.Log("Pressed: " + e.keyCode); } }, TrickleDown.TrickleDown); GetComponent<UIDocument>().rootVisualElement.Add(textField); }}