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.
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.
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.
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.
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!