Question by
Kurdle_4855 · Jan 05, 2016 at 10:59 PM ·
unity 5inputbug
Input.inputString returns empty on special keys
I'm making a game, and i've implemented a function that uses Input.inputString. All the keys return normally, except for keys like Backspace, Space, Return/Enter. These all return as null. Plz help.
Here's the code i'm using:
void Update() { Debug.Log(Input.inputstring); if(Input.inputString == "return") { do stuff } }
Comment
As the documentation says: http://docs.unity3d.com/ScriptReference/Input-inputString.html
So, if I undestood, you can try this:
if (Input.inputString == "\n"[0] || Input.inputString == "\r"[0])
{
// do stuff
}