Hi again! I was thinking more and, sorry, but didn’t catch the “with all the parameters” part. FInputModeGameAndUI has default constructor indeed but not with parameters.
Now I can see - there are 2 options you can do such initialization.
1 - because FInputModeGameAndUI has setters which returns references to itself in cpp file you can do such a thing:
FInputModeGameAndUI UMyClass::MyInputMode = FInputModeGameAndUI().SetWidgetToFocus(nullptr).SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock).SetHideCursorDuringCapture(false);
2 - you can create a default input mode and init it somewhere in begin play or PostInitProperties:
FInputModeGameAndUI UMyClass::MyInputMode = {};
void UMyClass::PostInitProperties()
{
Super::PostInitProperties();
static bool bStaticInit = false; // will be set to false only once
if (bStaticInit == false)
{
bStaticInit = true;
MyInputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
MyInputMode.SetHideCursorDuringCapture(false);
}