- Home /
Input keycode string not working
Hi everyone
Does anyone know how I can refer to the left parenthesis using the string?
I use the following code:
if(Input.GetKeyDown("(")){
Debug.Log("LeftParenthesis.Pressed");
CodeInput.text = CodeInput.text + ")";
}
I don't understand what I do wrong, if I click the parenthesis button it doesn't do anything.
I looked it up on the internet and only found that I needed to use that string code.
Thanks for all the help in advance.
Answer by $$anonymous$$ · Mar 24, 2021 at 12:28 AM
I found some thing but I am not a expert at c# so I don't understand it at all but this is the link URL : https://docs.unity3d.com/ScriptReference/Input-inputString.html If you understand it then tell me to.
I implemented it into my game and it worked!
Thanks @$$anonymous$$, I used the following code:
if(Input.inputString == "("){
Debug.Log("LP.Pressed");
}
Thanks again for all the help!
Answer by $$anonymous$$ · Mar 23, 2021 at 08:32 PM
Use the following code inside the if statement
If (input.GetKeyDown (KeyCode. Which ever key you want))
{}
That also doesn't work, the button that does work is keycode.alpha5.
I really don't know why the left apprentices doesn't work.
OK can you wait I will see what is wrong and tell you in about 2 hours or so
Your answer
Follow this Question
Related Questions
Inputfield set as Variable 1 Answer
Input returns 0 until released and pressed again if held down before start of scene 0 Answers
Getting the text from UIInput 1 Answer
How to check which key i have pressed? 3 Answers
How to schedule responses (based on player's input text) for text adventure game? 0 Answers