5.6 - UEnhancedInputUserSettings unavailable in UPlayerController::InitInputSystem

Hi,

We’re upgrading to 5.6 and found an issue with some of our code and changes made to input in 5.6.

Our custom player controller overrides UPlayerController::InitInputSystem. In that override, it retrieves the UEnhancedInputLocalPlayerSubsystem and then pulls the UEnhancedInputUserSettings object from that subsystem and populates some game specific InputMappingContext data into that settings object.

This previously worked fine in UE 5.5 because the UEnhancedInputUserSettings object was created in InitalizeUserSettings called from UEnhancedInputUserSettings::Initialize. But CL 556409 removed that function, instead driving it from the Player Controller Change delegate

The problem is that this changed the order of execution between creating the User Settings object and the calling of InitInputSystem. In 5.6 InitInputSystem is called first (from APlayerController::SetPlayer line 5250) and the creation of the UEnahncedInputUserSettings object is called second (APlayerController::SetPlayer line 5275).

Is there any guidance for how to convert this code? For our fix we’ve temporarily overridden SetPlayer in our game’s PlayerController and disabled the call to InitInputSystem in the UPlayerController. We then call InitInputSystem from our DerivedPlayerController::SetPlayer after Super::SetPlayer has executed

Steps to Reproduce

Hey there,

The reason that this changed is to add support for creating a dynamic save file name for the Enhanced Input user settings objects, instead of it being locked in to a single default name. This was added with this change you can see on GitHub: https://github.com/EpicGames/UnrealEngine/commit/5fe407364c3634cdba940bf494fd7036b5900517

Because the “GetSaveFileName” function is a virtual function on the UEnhancedPlayerInput object, and that object is created by the player controller, a valid player controller is required in order to properly load the save file. Since the Enhanced Input Local Player Subsystem would have it’s “Initalize” function called before InputInputSystem on the player controller, that is no longer a valid place to init the settings.

The `InitalizeUserSettings` function is public on the Enhanced Input subsystem, and is what will create the settings object. You can call this at any time so long as there is a valid player controller set on your subsystem. For now, I would stick with the workaround you have.

I have created this issue: Unreal Engine Issues and Bug Tracker (UE\-301958) which is to add some kind of delegate or overridable function for a “post settings initialize” to Enhanced Input.

Thanks for the feedback, and I hope that is a helpful explanation!

Ben