- Home /
This question was
closed Apr 22, 2021 at 05:09 PM by
allesman for the following reason:
Found the solution myself
Input.GetKeyDown doesn't work with several keys
For my game, I need to detect the pressing of the comma, period and minus key.
Input.GetKeyDown(KeyCode.Minus)
Input.GetKeyDown(KeyCode.Period)
Input.GetKeyDown(KeyCode.Comma)
None these return true when the key is pressed, despite detection of other keys working. I suspect it has something to do with the fact I have a German keyboard, but got no idea how to fix it. Help would be appreciated!
Comment
Answer by UnityM0nk3y · Apr 22, 2021 at 04:54 PM
Try this in Update:
void Update()
{
if(Input.GetKeyDown("."))
{
Debug.Log(". Pressed");
}
if (Input.GetKeyDown(","))
{
Debug.Log(", Pressed");
}
if (Input.GetKeyDown("-"))
{
Debug.Log("- Pressed");
}
}
Follow this Question
Related Questions
GetKeyDown code turned into a int issue [SOLVED] 1 Answer
Why is GetKeyDown returning false when provided with string from .inputString? 2 Answers
Enter/Exit Vehicle with the same key? 2 Answers
How to get a key hold to do something which is stored in a variable as KeyCode ? 1 Answer
What Key do you press to "Jump" in the T_T Tutorial? 2 Answers