Input.GetKeyDown don't work.
Hi. So i have this small function it called from gui button."SaveP" part is working fine,but part with Input not working at all.I don't have any errors it's just not working.What am I doing wrong here? Thank you.
public void OnSavebutton()
{
//InputF = GameObject.Find ("CarNameEnter");
SaveP.SetActive (true);
if (Input.GetKeyDown (KeyCode.Return)) {
InputField inp = InputF.GetComponent<InputField> ();
CarName = inp.text;
test = true;
}
}
Comment
hmmmmm.It's a button and you want it to Get input ?:D.I didn't know that it's possible.
Best Answer
Answer by Cuttlas-U · Sep 09, 2017 at 07:58 PM
hi; u have to put Input.GetKey into Update method cause it need to check every frame if its pressing or not ;