Disable analog stick input on UMG?

Hello all,

I am currently trying to make a menu similar to dark souls - where you navigate it using the D-Pad whilst the analog stick still controls your character. Currently it ‘works’ except moving the character also moves the current focused widget button. I am wondering if there is a way to stop the UMG widget from using any input from the analog sticks.

Hope someone can help and thank you in advance!

Did you find a solution?

I am also interested for a solution on this topic.

Couple years down the line, but hopefully still valid for someone.

  1. In UMG override function "On Analog Value Changed
  2. Connect “Handled” to the output

286397-disableanaloginput.png

Thank you, I found a solution for this problem by filtering the input key in the “Key Up overide”

When I use this it makes the analog stop for the character. Is there a way to make it do the opposite? I just want the the character to move with the analog stick and the widget UI to be controlled with only the dpad.

Did you find a solution?

Did you find any solution to this?

I’ve recently wanted to do similar to the OP. It seems the intended way to accomplish this is deriving a struct from FNavigationConfig and registering it with the FSlateApplication using FSlateApplication::SetNavigationConfig. This approach allowed me to easily modify gamepad navigation behavior at runtime.

1 Like

Could You Please teach me how did you do that ? Because just by your explanation i could’nt make it to work! Many Thanks!

The solution mentioned by @jbl4ir essentially works.
Here’s how I’ve done it - I created a function that accesses the NavigationConfig from FSlateApplication, and setts the bAnalogNavigation to true/false.

#include "Framework/Application/NavigationConfig.h"

void AMyPlayerController::ToggleThumbstickUiNavigation(bool ThumbstickNavigationEnabled) {
	if (FSlateApplication::IsInitialized()) {
		TSharedRef<FNavigationConfig> currentNavConfig = FSlateApplication::Get().GetNavigationConfig();
		currentNavConfig->bAnalogNavigation = ThumbstickNavigationEnabled;
		FSlateApplication::Get().SetNavigationConfig(currentNavConfig);
	}
}
	const auto navigation = MakeShared<FNavigationConfig>();
	navigation->bKeyNavigation = true;
	navigation->bTabNavigation = false;
	navigation->bAnalogNavigation = false;
	FSlateApplication::Get().SetNavigationConfig(navigation);

only need in GameMode or other initial add.

Using @SumbodySumwher logic, in case anyone needs this. Just add a new C++ class from within the Editor (if you’re a noob like me), then can choose smth like Blueprint Function Library as the parent class, name it MyBlueprintFunctionLibrary.

Then, in .h

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "Framework/Application/SlateApplication.h"
#include "Framework/Application/NavigationConfig.h"
#include "MyBlueprintFunctionLibrary.generated.h"

UCLASS()
class YOURPROJECT_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

public:

    UFUNCTION(BlueprintCallable, Category = "UI")
    static void ToggleThumbstickUiNavigation(bool bEnableThumbstickNavigation);
};

and in .cpp

#include "MyBlueprintFunctionLibrary.h"

void UMyBlueprintFunctionLibrary::ToggleThumbstickUiNavigation(bool bEnableThumbstickNavigation)
{
    if (FSlateApplication::IsInitialized())
    {
        // Get the current navigation configuration
        TSharedRef<FNavigationConfig> CurrentNavConfig = FSlateApplication::Get().GetNavigationConfig();

        // Set the bAnalogNavigation flag to enable or disable thumbstick navigation
        CurrentNavConfig->bAnalogNavigation = bEnableThumbstickNavigation;

        // Apply the updated navigation configuration
        FSlateApplication::Get().SetNavigationConfig(CurrentNavConfig);
    }
}

Then, after regenerating visual studio files by right clicking on your .uproject and selecting Generate Visual Studio files, if you try to build the project, and if you get linking issues, check that this is uncommented in your YourProjectName.Build.cs file:

// Uncomment if you are using Slate UI
PrivateDependencyModuleNames.AddRange(new string[] { Slate, SlateCore });

After that, you can call that function from Blueprints. Hope this helps!

1 Like

I’m trying to make a Menu system similar to Cyberpunk’s in where the cursor is controllable by both Gamepad thumbstick and Mouse but focus between buttons on gamepad is easily switchable via the D-pad (mouse would follow by getting btn transforms and set mouse cursor.) I have the thumbstick cursor navigation set up (pretty easy, currently used for interacting with in game computer screens) however came across the issue in menus with focusable buttons where the cursor movement gets consumed by focus as soon as the cursor focuses a button (Had my menu set focus when cursor hovers.)
This would be fine (I want focus to be there but only D-pad) however the focus navigation w/ thumbstick fully overrides the thumbstick cursor movement script I’ve made. Saw this thread and thought while the use case is different the functionality might be applicable for my use case.

Created the C++ class as a BP Function library, implemented the necessary function, it compiled fine, called in BP for my menu class and it doesn’t work at all. Thumbstick still moves the focus instead of just the D-Pad. I thought there might be a separate UI functionality that might be in play that consumes any input on focus (My Input mode is set to both UI and game btw) since input is especially stiff in Unreal Widgets and if this solution had actually worked there would be something else to tackle (eg: The custom function would disable the thumbstick navigation as intended, but focus would still freeze/consume my thumbstick cursor script) but it seems like it’s not even working at all. Button focus is still controllable via thumbstick.

I thought about disabling focus entirely, but then I’d have to either go cursor only, or create my own “Pseudo Focus” to navigate via D-pad which would require a lot of work just for some menus.

I’ll probably make my own question thread as the use case is different and there might be something else I’m missing for this solution that doesn’t apply to the OP, however if anyone knows if this is somehow different in my Engine Ver (Using 5.3) that could help. Everything is the same as the quoted code (aside from my Project name/API) and everything compiles, and I am able to access the function in BP. Thanks