[Solved] NumberWizard - Why do we use KeyCode.UpArrow instead of "up"


I watched the NumberWizard lesson and have a question. Why do we use this

if (Input.GetKeyDown (KeyCode.UpArrow))

instead of this:

if (Input.GetKeyDown ("up"))

I used the latter one and it works quite well. So can you explain to me what is different between 2 methods?

Hello, there is no difference at all.

The good thing about using KeyCode.UpArrow is that the compiler will be able to auto complete it since it is a known variable, while using the string you will have to make sure to type it correctly.

1 Like

Thank you for your answer :smiley:

1 Like

Privacy & Terms