29 UInputSettings* InputSettings = UInputSettings::GetInputSettings();
30 TArray<FName> ActionNames;
31 InputSettings->GetActionNames(ActionNames);
32 for (
const auto& ActionName : ActionNames)
34 TArray<FInputActionKeyMapping> ActionMappings;
35 InputSettings->GetActionMappingByName(ActionName,ActionMappings);
36 for (
const auto& Mapping : ActionMappings)
38 InputSettings->RemoveActionMapping(Mapping);
42 TArray<FName> AxisNames;
43 InputSettings->GetAxisNames(AxisNames);
44 for (
const auto& AxisName : AxisNames)
47 InputSettings->GetAxisMappingByName(AxisName,
AxisMappings);
50 InputSettings->RemoveAxisMapping(Mapping);
54 InputSettings->ForceRebuildKeymaps();
59 UInputSettings* InputSettings = UInputSettings::GetInputSettings();
60 for (
const auto CustomMapping : CustomMappings)
62 for(
const TPair<EPlatform, FKey>& Input : CustomMapping->InputMapping)
64 FInputActionKeyMapping InputKeyMapping;
65 InputKeyMapping.Key = Input.Value;
66 InputKeyMapping.ActionName = CustomMapping->InputName;
67 InputSettings->AddActionMapping(InputKeyMapping);
69 for(
const FAxisKeyData& AxisInput : CustomMapping->AxisInputMapping)
71 for(
const FInputAxisKeyMapping& InputKey : AxisInput.InputKeys)
73 FInputAxisKeyMapping InputKeyMapping;
74 InputKeyMapping.Key = InputKey.Key;
75 InputKeyMapping.Scale = InputKey.Scale;
76 InputKeyMapping.AxisName = CustomMapping->InputName;
77 InputSettings->AddAxisMapping(InputKeyMapping);
82 InputSettings->SaveKeyMappings();
83 const FString DefaultInputFilePath = FPaths::SourceConfigDir() +
"DefaultInput.ini";
84 InputSettings->SaveConfig(CPF_Config, *DefaultInputFilePath);
85 InputSettings->ForceRebuildKeymaps();