Remapping the default UI navigation keys

Not quite sure if this is an easy task. In my Widgets, I am able to move around the buttons using the keys on my keyboard (Up, down, left, right arrows), now, to press on a button, you can do so by pressing enter or spacebar. However, the spacebar is connected to another action and I cannot have it activate the press of that button. This is however automatically there at default, is there a particular way to remap which keys can do what in your UI navigation?

This could also make WASD navigation between buttons possible or pressing Y on a gamepad to activate a button instead of A and so on.

1 Like

I haven’t found a way to do it since, but for my particular problem, I just disabled the input on another function that would usually be activated. It would still be useful to know how to remap these though!

I have a similar problem. Is there a way to modify default widget navigation system?

Yap, I still has same problem in 2023

same problem in 2024

Maybe found a fix for your problem.


Basically it will block the enter and space bar input in the entire widget, but on the true line you can call any function or custom event and run that with the key you wanted.

This works perfectly, 5 years to late though,

its pretty todo

Set up a GameModeBase C++ class below is my code just change your API, and then set the game mode up as that and it works great

and add in the dependices too to the build file

This was workign in UE5.4.2

----------------CPP---------------------------------

#pragma once

include “CoreMinimal.h”
include “GameFramework/GameModeBase.h”
include “Framework/Application/SlateApplication.h”
include “Framework/Application/NavigationConfig.h”
include “MyGameModeBase.generated.h”

// Custom Navigation Config class declaration
class FCustomNavigationConfig : public FNavigationConfig
{
public:
FCustomNavigationConfig()
{
// Map WASD to navigate like arrow keys
KeyEventRules.Emplace(EKeys::W, EUINavigation::Up);
KeyEventRules.Emplace(EKeys::S, EUINavigation::Down);
KeyEventRules.Emplace(EKeys::A, EUINavigation::Left);
KeyEventRules.Emplace(EKeys::D, EUINavigation::Right);
}
};

UCLASS()
class FALKEGG2_API AMyGameModeBase : public AGameModeBase
{
GENERATED_BODY()

protected:
virtual void BeginPlay() override;
};

------ HEADER -----------

include “MyGameModeBase.h”
include “Framework/Application/SlateApplication.h”
include “Framework/Application/NavigationConfig.h”

void AMyGameModeBase::BeginPlay()
{
Super::BeginPlay();

// Create and apply the custom navigation configuration
TSharedRef CustomNavConfig = MakeShared();
FSlateApplication::Get().SetNavigationConfig(CustomNavConfig);

}

------Build.cs-------------

PublicDependencyModuleNames.AddRange(new string { “Core”, “CoreUObject”, “Engine”, “InputCore”, “EnhancedInput”,“Paper2D”,“PhysicsCore” , “Slate”, “SlateCore” });

PrivateDependencyModuleNames.AddRange(new string { “Slate”, “SlateCore” });