Version: 2022.1

Event.functionKey

切换到手册
public bool functionKey ;

描述

当前按键是否是功能键?(只读)

如果当前按键是箭头键、向上翻页、向下翻页、退格键等,则返回 true。 如果该键需要特殊处理才能在文本编辑中工作,则 functionKey 为打开。

using UnityEngine;

public class Example : MonoBehaviour { // Detects if a function Key was pressed if a // function key was pressed, prints its key code. void OnGUI() { Event e = Event.current; if (e.functionKey) { Debug.Log("Pressed: " + e.keyCode); } } }