Hi! I’m trying to figure out how to work with user settings (keyboard hotkeys, etc.) and I have one problem: when I try to pull out the current input settings, the settings are null.
That’s how i try to get it:
if (const UEnhancedInputLocalPlayerSubsystem* System ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(OwningPlayer))
{
if (UEnhancedInputUserSettings* InputSettings = System->GetUserSettings()) /* GetUserSettings() return null */
{
....
}
}
In PlayerController:
void APwPlayerController::BeginPlay()
{
Super::BeginPlay();
checkf(MappingContext, TEXT("Probably you forgot to set MappingContext object in Blueprint"));
if (UEnhancedInputLocalPlayerSubsystem* PlayerSubsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
{
PlayerSubsystem->AddMappingContext(MappingContext, 0);
}
}
As i understand i need to save settings before trying to get it or what i need to do? Thanks!