How to get c# to know a user pressed a key? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get c# to know a user pressed a key?

Im doing a" if input () " for a game im coding on unity (visaul studios: c#) and need help know what to put there so that it would know when someone presses that key?

12th Nov 2019, 2:35 PM
rj503
rj503 - avatar
2 Answers
0
The if statement would do it. I.E." if (Input.GetKey("w")) { pos.y += jump * Time.deltaTime; } " Some Unity tutorials would also help you get started https://unity.com/learn
12th Nov 2019, 4:49 PM
Adrian Vassallo
Adrian Vassallo - avatar
0
Thank you i see what i did wrong now i was using GetKey but the period. Thanks.
12th Nov 2019, 4:51 PM
rj503
rj503 - avatar