# Remapping the default UI navigation keys

**URL:** <https://forums.unrealengine.com/t/remapping-the-default-ui-navigation-keys/452916>\
**Category:** UI\
**Tags:** unreal-engine, UI, Widget, Blueprint, question, UMG\
**Created:** [July 27, 2019, 10:20am UTC](https://forums.unrealengine.com/t/remapping-the-default-ui-navigation-keys/452916 "2019-07-27T10:20:24Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![rocknswole](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rocknswole](https://forums.unrealengine.com/u/rocknswole)\
**Post date:** [October 17, 2024, 1:02am UTC](https://forums.unrealengine.com/t/remapping-the-default-ui-navigation-keys/452916/8 "2024-10-17T01:02:31Z")

</div>

This works perfectly, 5 years to late though,

> [@Control UI using WASD instead of Arrow Keys?](https://forums.unrealengine.com/t/control-ui-using-wasd-instead-of-arrow-keys/456920):
>
> Hello, I’ve created a UI Menu that can be navigated with a gamepad or the keyboard arrow keys. This was done by setting the game focus to my UI widget. However, because my game uses WASD to move, I feel like it would be more intuitive and feel more natural if the player could navigate the menu using WASD as well/instead of the arrow keys. Is there a setting, or perhaps method to do this?

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” });

---

_[View the full topic](https://forums.unrealengine.com/t/remapping-the-default-ui-navigation-keys/452916)._
