首页 > 解决方案 > How to use the same input twice or more

问题描述

Heres My Code

 void Update()
{

    if (Input.GetKeyDown(KeyCode.Space))
    {
        ContinueDialog();
        Cursor.lockState = CursorLockMode.Locked;
    }

}

I wanna use the space input twice or more to access my other function is there a way?

标签: c#unity3d

解决方案


您可以在代码的其他地方使用相同的功能。Input.GetKeyDown() 函数为按下键的第一帧返回 true,如下所示: https ://docs.unity3d.com/ScriptReference/Input.GetKeyDown.html


推荐阅读