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!