widget Onkeydown repeating.

Hi.

I’m playing a level sequence triggered by the player walking inside a triggerbox. I start the level sequence and adds an invisible widget on top to read keypress in order to skip the scene.

The problem is that the onkeydown event in the widget keeps firing. So it will skip instantly because the player will have W pressed when walking inside the box.

I can’t figure out why the event spams. If i use onkeyup it only fires once.

I added a print string to on focus lost to make sure that focus isn’t what’s causing it, but it isn’t. Flush input is checked as well.

Just to make sure it wasn’t something else. Made a new empty project. put a new actor in the world which just creates the widget.

Then in the widget the only code is the following.

The event keeps firing while the button is down… Is this really meant to work this way?

No. What is the Begin Play inside of? How many times does that trigger?

The begin play is in the empty actor i created and put in the world. Only purpose is to show the UI.

Edit:
Added a print string at the end of it. Only happened once.

Could you confirm?

Yes. It only happens once.

  • how often does it spam, every frame?
  • does the spam stop once the key is up?
  • what other script is there in the widget?
  • perhaps there are some bound functions?

My bet is that the issue is with something we cannot see in the screenshots. As confused as you are, especially considering:

added a print string to on focus lost to make sure that focus isn’t what’s causing it

It’s about 1 time per 5 ticks. Too much of a newbie to know a good way to do this, so i just added a print string in the actor’s tick event, held down the key and screenshotted it.

There are no other scripts at all. it’s a blank project with those 2 things in the screenshots as the only things added.

The odd thing is that onKeyUp does not act this way. it works as i would expect it to with the exact same code.

Intriguing, actually. What’s in the widget hierarchy? Here’s my best grasp at straws:

You mash space and a native button consumes input, and then releases a reply via the Precise Click option. Trying to find a way to reproduce it in my head… :innocent: Because that could do it. But you’d need to specifically set it up this way… which is unlikely.