- Home /
How to get Key with KeyCode.Question?
Hi, I'm working on a minigame but I can not get the key when the user presses "?" or "@", with the following code:
if (Input.GetKeyDown("@"))
{
word+= "?";
}
if (Input.GetKeyDown("@"))
{
word+= "@";
}
if (Input.GetKeyDown(KeyCode.Question)) // i try too like this
{
word+= "?";
}
Comment
Good day.
@ is not a key, is a symbol in a key, in my country , the symbol @ is in the "2" key, so the key is "2". If you pretend the user to press "Shift"+"2" ,then make it as @Ar$$anonymous$$Ahmadi says.
Bye!
Answer by ArminAhmadi · Jan 28, 2019 at 06:38 AM
I don't know what exactly you are trying to do and this is not a perfect solution but it might help.
private void Update()
{
if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Slash))
{
Debug.Log("? key has been pressed.");
}
if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Alpha2))
{
Debug.Log("@ key has been pressed.");
}
}
Your answer
Follow this Question
Related Questions
Stimulate key press via a GUITexture 0 Answers
i can assign all keys but the shift any ideas 4 Answers
problem with mapping keys through c# 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers