🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Multiple keystrokes registered

Started by
1 comment, last by Shaarigan 2 years, 11 months ago

I've started unity dev with Ben's udemy course and while working on ‘Respond to Player Input’ in the Number wizard module, I ran with an issue where a single keystroke often types out 30+ lines of console output.

if (Input.GetKey(KeyCode.UpArrow))
        {
            print("up arrow key is held down");
        }

Please guide me.

Advertisement

From the Unity Documentation

Returns true while the user holds down the key identified by name

Since I guess you're doing this in the Update function, it is looping up to 70 times per second depending on your framerate. So please get to know what you're doing before posting

This topic is closed to new replies.

Advertisement