37 UInputSettings* InputSettings = UInputSettings::GetInputSettings();
38 TArray<FName> ActionNames;
39 InputSettings->GetActionNames(ActionNames);
40 for (
const auto& ActionName : ActionNames)
42 TArray<FInputActionKeyMapping> ActionMappings;
43 InputSettings->GetActionMappingByName(ActionName,ActionMappings);
44 for (
const auto& Mapping : ActionMappings)
46 InputSettings->RemoveActionMapping(Mapping);
50 TArray<FName> AxisNames;
51 InputSettings->GetAxisNames(AxisNames);
52 for (
const auto& AxisName : AxisNames)
54 TArray<FInputAxisKeyMapping> AxisMappings;
55 InputSettings->GetAxisMappingByName(AxisName,AxisMappings);
56 for (
const auto& Mapping : AxisMappings)
58 InputSettings->RemoveAxisMapping(Mapping);
62 InputSettings->ForceRebuildKeymaps();
67 UInputSettings* InputSettings = UInputSettings::GetInputSettings();
68 for (
const auto CustomMapping : CustomMappings)
70 for(
const TPair<EPlatform, FKey>& Input : CustomMapping->InputMapping)
72 FInputActionKeyMapping InputKeyMapping;
73 InputKeyMapping.Key = Input.Value;
74 InputKeyMapping.ActionName = CustomMapping->InputName;
75 InputSettings->AddActionMapping(InputKeyMapping);
77 for(
const FAxisKeyData& AxisInput : CustomMapping->AxisInputMapping)
79 for(
const FInputAxisKeyMapping& InputKey : AxisInput.InputKeys)
81 FInputAxisKeyMapping InputKeyMapping;
82 InputKeyMapping.Key = InputKey.Key;
83 InputKeyMapping.Scale = InputKey.Scale;
84 InputKeyMapping.AxisName = CustomMapping->InputName;
85 InputSettings->AddAxisMapping(InputKeyMapping);
90 InputSettings->SaveKeyMappings();
91 const FString DefaultInputFilePath = FPaths::SourceConfigDir() +
"DefaultInput.ini";
92 InputSettings->SaveConfig(CPF_Config, *DefaultInputFilePath);
93 InputSettings->ForceRebuildKeymaps();