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