Version: 2023.2
public static bool anyKey ;

描述

当前是否有任何键或鼠标按钮处于按下状态?(只读)

using UnityEngine;

public class Example : MonoBehaviour { // Detects if any key has been pressed.

void Update() { if (Input.anyKey) { Debug.Log("A key or mouse click has been detected"); } } }