KeyCode.Escape

Description

Escape key.

using UnityEngine;

public class Example : MonoBehaviour { void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { Debug.Log("Escape key was pressed"); }

if (Input.GetKeyUp(KeyCode.Escape)) { Debug.Log("Escape key was released"); }

if (Input.GetKey(KeyCode.Escape)) { Debug.Log("Escape key is being pressed"); } } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答