[Solved but better answer can be found] [New Input System] How to save & load the player modifications ?

I’m using the new input system and I have an option menu to change the binding of the inputs but I don’t know how to save them so I can load them between sessions.


I have this Input Action file named GamePlay


So I think I just have to save the path and then use InputAction.ApplyBindingOverride as I do when remaping* but the problem is that I don’t know where to get the path of the InputAction.

Is there something like

MyInputActionClass.ActionMap.InputAction.path    

Of course if there is better way to save I would be happy to know them :slight_smile:


  • Here is my remaping function :

     void RemapButtonClicked(InputAction actionToRebind)
     {
         var rebindOperation = actionToRebind.PerformInteractiveRebinding()
                     .OnMatchWaitForAnother(0.1f)
                     .WithCancelingThrough("")
                     .Start();
         rebindOperation.OnApplyBinding((op, path) => {
             actionToRebind.ApplyBindingOverride(path);
             rebindOperation.Dispose();
         });
     }
    

So I found a solution to save the changed input, here is what I do :

When the user apply the changes I get the overridePath property like this :

string path = MyInputActionClass.ActionMap.InputAction.bindings[index].overridePath;

I save this path and when loading inputs :

MyInputActionClass.ActionMap.InputAction.ApplyBindingOverride(path);

Some documentation that I used :

https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/api/UnityEngine.InputSystem.InputAction.html#UnityEngine_InputSystem_InputAction_name

&

https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/ActionBindings.html