EnhancedInput | UserSettings are null

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!

Do you have it enabled in project settings ? In project setting search for user settings.

1 Like

Oh, yes, indeed I forgot to enable this option, now it works as expected, thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.