Help whit keys script

I would like to know how I can do to put two keys where it says “if (Input.GetKeyDown (KeyCode.Escape))” I would like that function to be activated with the E key and Escape

public class CurcorHideShow : MonoBehaviour
{
    public bool isLocked = true;

    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            isLocked = !isLocked;
        }
        Cursor.lockState = isLocked ? CursorLockMode.Locked : CursorLockMode.None;
        Cursor.visible = !isLocked;
    }
}

If i understand you correctly its a simple && or || in the if() → check this out
&& Escape and E needs to be pressed
|| Escape or E needs to be pressed

eksample :

public class CurcorHideShow : MonoBehaviour
{
    public bool isLocked = true;
    // Start is called before the first frame update
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.E)) // Or if both needs to be pressed use && insted of ||
        {
            isLocked = !isLocked;
        }
        Cursor.lockState = isLocked ? CursorLockMode.Locked : CursorLockMode.None;
        Cursor.visible = !isLocked;
    }
}
1 Like

Yes, thanks