# Set input mode UI only makes inputAxis Value stuck

**URL:** <https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [July 14, 2018, 12:28pm UTC](https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580 "2018-07-14T12:28:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adolfo\_Domigues](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Adolfo\_Domigues](https://forums.unrealengine.com/u/Adolfo_Domigues)\
**Post date:** [July 14, 2018, 12:28pm UTC](https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580/1 "2018-07-14T12:28:44Z")

</div>

Hi,

when I use “set input mode UI only” while my character is moving my character keeps moving on his own when going back to “input mode game” until I press W and release W again.

So for some reason the Input Axis value gets stuck on 1 even thought I am not pressing any key. Until I press and release the key then the Axis value becomes 0 again.

Is there a workaround for this? Can I reset an Input Axis somehow or anything like this? Thanks for helping 🙂

---

<div class="post-metadata">

**Author:** ![FreezerNick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/freezernick/32/480692_2.png) [@FreezerNick](https://forums.unrealengine.com/u/FreezerNick)\
**Post date:** [July 14, 2018, 2:55pm UTC](https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580/2 "2018-07-14T14:55:09Z")

</div>

For Singleplayer I use Pause / Unpause game and for Multiplayer I make a check whether the player is moving or not and if he does he can’t access the pause menu.  
I don’t know if there is a specific function for resetting the Axis value manually but my workaround works fine for me

Edit: or you can set a bool to true when in UI only mode and while it’s true set the speed to 0. This was my first attempt for the Multiplayer issue but it’s no the best situation when for example an enemy player suddenly stops from high speeds for example.

---

<div class="post-metadata">

**Author:** ![Adolfo\_Domigues](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Adolfo\_Domigues](https://forums.unrealengine.com/u/Adolfo_Domigues)\
**Post date:** [July 15, 2018, 2:51pm UTC](https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580/3 "2018-07-15T14:51:00Z")

</div>

> [@FreezerNick](#):
>
> For Singleplayer I use Pause / Unpause game and for Multiplayer I make a check whether the player is moving or not and if he does he can’t access the pause menu.  
> I don’t know if there is a specific function for resetting the Axis value manually but my workaround works fine for me
> 
> Edit: or you can set a bool to true when in UI only mode and while it’s true set the speed to 0. This was my first attempt for the Multiplayer issue but it’s no the best situation when for example an enemy player suddenly stops from high speeds for example.

Thank you for your reply! My game is single player but I can’t use pause because I want the game to keep running when the menu is open. Only letting the player pause when not moving would work I guess but that sounds quite annoying for the player since there is no real reason for having to do that. I hope I can find a workaround with less harsh side effects 😕

Also for your second idea my player can do a lot more stuff than just moving so disabling all this manual would be a pain.

edit: I tried disabling the controller input 1 or 2 frames before opening the menu but even this did not fix the bug

---

<div class="post-metadata">

**Author:** ![rit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rit](https://forums.unrealengine.com/u/rit)\
**Post date:** [October 20, 2020, 8:58am UTC](https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580/4 "2020-10-20T08:58:49Z")

</div>

> [@Adolfo\_Domigues](#):
>
> Hi,
> 
> when I use “set input mode UI only” while my character is moving my character keeps moving on his own when going back to “input mode game” until I press W and release W again.
> 
> So for some reason the Input Axis value gets stuck on 1 even thought I am not pressing any key. Until I press and release the key then the Axis value becomes 0 again.
> 
> Is there a workaround for this? Can I reset an Input Axis somehow or anything like this? Thanks for helping 🙂

I’ve experienced the exact issue today.

After digging into the C++ code of UE4, it turns out the engine will stop listening to all game-related registered input after calling _SetInputModeUIOnly()_

```auto

GameViewportClient.SetIgnoreInput(true);

```

Set the flag _bIgnoreInput_ to true, will cause all the axis binding, action binding events be ignored, including the RELEASE event:

```auto

bool UGameViewportClient::InputAxis(FViewport* InViewport, int32 ControllerId, FKey Key, float Delta, float DeltaTime, int32 NumSamples, bool bGamepad)
{
if (IgnoreInput())
{
return false;
}

...

```

Since the RELEASE event is ignored, the key state (axis value) remains the same. That is probably why after changing to _SetInputModeGameOnly()_ the character keeps moving in the same direction until you press the relevant key again (update the old axis value).

A workaround for me is to call

```auto

PlayerController->PlayerInput->FlushPressedKeys();

```

**after** _SetInputModeUIOnly()_ to manually reset the value of all axis bindings and action bindings.

After some test runs, this method seems to fix the issue for me.

I know this is an old post, however, I hope this could help people who experienced the same problem.

Hopefully, this issue is resolved in later versions of UE.

---

<div class="post-metadata">

**Author:** ![Alain2131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alain2131](https://forums.unrealengine.com/u/Alain2131)\
**Post date:** [February 8, 2021, 12:34am UTC](https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580/5 "2021-02-08T00:34:31Z")

</div>

Hey @rit, thanks for the tip, it worked perfectly for me !

What I did is inside a BlueprintFunctionLibrary, I have the following

BPFL.h

```auto

UFUNCTION(BlueprintCallable)
static void flushInputs(const APlayerController* PlayerController);

```

BPFL.cpp

```auto

#include "GameFramework/PlayerInput.h"

// ...other includes and code for other things...]

void UBPFL::flushInputs(const APlayerController* PlayerController)
{
PlayerController->PlayerInput->FlushPressedKeys();
}

```

This gives me a node inside blueprint that I can place before or after the Input Mode.

 ![Screenshot 2021-02-07 193644.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/3/93ba8b81a8168828cce2cfd97632734ba417a6c5.png)

And that fixed my issue !  
Thanks again 🙂

---

<div class="post-metadata">

**Author:** ![chuck3201](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@chuck3201](https://forums.unrealengine.com/u/chuck3201)\
**Post date:** [April 10, 2024, 5:57pm UTC](https://forums.unrealengine.com/t/set-input-mode-ui-only-makes-inputaxis-value-stuck/113580/6 "2024-04-10T17:57:15Z")

</div>

You are a life saver man. Thanks for posting this!
