How do I enable Key Repeat?

I am using APlayerController::WasInputKeyJustPressed an I would like to enable Key Repeat.

How do I do that?

Elaborate a bit more, how do you want to use Key Repeat? If you just want to check for input held down see this thread.

I would like to be able to set a delay and an interval for repetition of keys when pressed.

Hey z0q-

Could you elaborate on what you mean by key repeat? Are you trying to create a setup where a key is pressed and then ignored for a set amount of time before reading it again? Or are you trying to continually a key while it is being pressed?

TBH I don’t think you need to repeat the key. You have tick, key pressed, key released. On key pressed set a flag saying the key is down and then on tick track the time you want to execute the command the key is bound to again and reset the timer and start again. Then once you detect the key released event just reset the flag.

Unless I’m not understanding what you are trying to do.

UE4 also has timers that could make this even easier. They bind to a function, you can cancel them, and you can tell them to loop. So on pressed just start a looping timer, on released just cancel it. Should only be a few lines of code

Dear Mr. ,

I’m trying to simulate a similar effect to what Microsoft Windows uses while typing in Notepad for example. The SDL library contains a function which does exactly what I mean SDL_EnableKeyRepeat. I am developing a small chat functionality for my game and would like to enable key repeat, so that players don’t have to type the same key over and over again while using the same key.

Thank you. This would be an option. I was hoping there would be an integrated function for this, similar to SDL_EnableKeyRepeat in the SDL library.

@z0q if this worked for you can you please this as answered? It helps when others are looking for answers if they see that this answer worked.

I’ll this as answered for tracking purposes, but if you can, z0q, please let us know how it turned out for you.