Search Unity

Bug Weird error when using rebinding save sample

Discussion in 'Input System' started by Bumpty, Aug 9, 2022.

  1. Bumpty

    Bumpty

    Joined:
    Jul 22, 2018
    Posts:
    33
    Hello, I'm getting this error when using LoadBindingOverridesFromJsonInternal, can someone help me?

    Code (CSharp):
    1. NotImplementedException: The method or operation is not implemented.
    2.   at UnityEngine.InputSystem.InputActionRebindingExtensions.LoadBindingOverridesFromJsonInternal (UnityEngine.InputSystem.IInputActionCollection2 actions, System.String json) [0x000b8] in C:\Users\neven\Documents\GitHub\BountyWanted\Library\PackageCache\com.unity.inputsystem@1.3.0\InputSystem\Actions\InputActionRebindingExtensions.cs:1271
    3.   at UnityEngine.InputSystem.InputActionRebindingExtensions.LoadBindingOverridesFromJson (UnityEngine.InputSystem.IInputActionCollection2 actions, System.String json, System.Boolean removeExisting) [0x00027] in C:\Users\user\Documents\GitHub\BountyWanted\Library\PackageCache\com.unity.inputsystem@1.3.0\InputSystem\Actions\InputActionRebindingExtensions.cs:1198
    4.   at RebindSaveLoad.OnEnable () [0x00019] in C:\Users\user\Documents\GitHub\BountyWanted\Assets\Samples\Input System\1.3.0\Rebinding UI\RebindSaveLoad.cs:11
    UPDATE :
    The error is still going on, even if I only change one binding at a time.
    The save load correctly for one control scheme and I get the previously registered inputs but not for the other control scheme.

    Here is the RebindSaveLoad.cs script used to save the bindings to playerPrefs :

    Code (CSharp):
    1. public class RebindSaveLoad : MonoBehaviour
    2. {
    3.     public InputActionAsset actions;
    4.  
    5.     public void OnEnable()
    6.     {
    7.         var rebinds = PlayerPrefs.GetString("rebinds");
    8.         if (!string.IsNullOrEmpty(rebinds))
    9.             actions.LoadBindingOverridesFromJson(rebinds);
    10.     }
    11.  
    12.     public void OnDisable()
    13.     {
    14.         var rebinds = actions.SaveBindingOverridesAsJson();
    15.         PlayerPrefs.SetString("rebinds", rebinds);
    16.     }
    17. }
    I checked my Json file and I don't see anything weird there here is an example of what I get

    Code (Boo):
    1. {
    2.   "bindings": [
    3.     {
    4.       "action": "Player/DashJoinConfirm",
    5.       "id": "22e76db0-254d-4718-9675-ac57504fdea0",
    6.       "path": "<Keyboard>/d",
    7.       "interactions": "",
    8.       "processors": ""
    9.     },
    10.     {
    11.       "action": "Player/ShowStats",
    12.       "id": "eb48a611-5606-4707-a1ab-f7115df60802",
    13.       "path": "<Keyboard>/a",
    14.       "interactions": "",
    15.       "processors": ""
    16.     },
    17.     {
    18.       "action": "Player/PauseGame",
    19.       "id": "76e11a53-5efb-4b8f-b34c-c898bb2b492b",
    20.       "path": "<Keyboard>/p",
    21.       "interactions": "",
    22.       "processors": ""
    23.     },
    24.     {
    25.       "action": "Player/Navigate",
    26.       "id": "9e86a9b9-9bc1-47ac-bba7-06246e7e1728",
    27.       "path": "<Keyboard>/s",
    28.       "interactions": "",
    29.       "processors": ""
    30.     },
    31.     {
    32.       "action": "Player/Navigate",
    33.       "id": "8a560d6a-7a0b-4da5-9196-02ec9644df84",
    34.       "path": "<Keyboard>/x",
    35.       "interactions": "",
    36.       "processors": ""
    37.     },
    38.     {
    39.       "action": "Player/Navigate",
    40.       "id": "b8a44314-9c1a-4181-82bc-ff4f69660599",
    41.       "path": "<Keyboard>/z",
    42.       "interactions": "",
    43.       "processors": ""
    44.     },
    45.     {
    46.       "action": "Player/Navigate",
    47.       "id": "83865251-a6e9-46b8-ba5a-dea1f7b8387e",
    48.       "path": "<Keyboard>/c",
    49.       "interactions": "",
    50.       "processors": ""
    51.     },
    52.     {
    53.       "action": "Player/Submit",
    54.       "id": "3fd3c2aa-f153-4043-8b92-d3c5d7739c85",
    55.       "path": "<Keyboard>/d",
    56.       "interactions": "",
    57.       "processors": ""
    58.     },
    59.     {
    60.       "action": "Player/MovementKeyboard3",
    61.       "id": "e170534e-1321-4eb8-b604-edab01f1b8bb",
    62.       "path": "<Keyboard>/upArrow",
    63.       "interactions": "",
    64.       "processors": ""
    65.     },
    66.     {
    67.       "action": "Player/MovementKeyboard3",
    68.       "id": "9f41800e-b8cc-4cac-a972-017cd8c8a387",
    69.       "path": "<Keyboard>/downArrow",
    70.       "interactions": "",
    71.       "processors": ""
    72.     },
    73.     {
    74.       "action": "Player/MovementKeyboard3",
    75.       "id": "4d3631e5-d664-42b9-a327-28597e1c2d24",
    76.       "path": "<Keyboard>/leftArrow",
    77.       "interactions": "",
    78.       "processors": ""
    79.     },
    80.     {
    81.       "action": "Player/MovementKeyboard3",
    82.       "id": "814d473b-c5a8-4935-84c2-a87e1406fe2e",
    83.       "path": "<Keyboard>/rightArrow",
    84.       "interactions": "",
    85.       "processors": ""
    86.     },
    87.     {
    88.       "action": "Player/DashJoinConfirm3",
    89.       "id": "ff2ee07e-bf10-4971-adbe-fb460d3d81da",
    90.       "path": "<Keyboard>/OEM1",
    91.       "interactions": "",
    92.       "processors": ""
    93.     },
    94.     {
    95.       "action": "Player/ShowStats3",
    96.       "id": "7c9e00c7-8931-488d-9cd4-a0c6dd88018f",
    97.       "path": "<Keyboard>/numpad0",
    98.       "interactions": "",
    99.       "processors": ""
    100.     },
    101.     {
    102.       "action": "Player/MovementKeyboard1",
    103.       "id": "36117ece-dfe6-4e7d-8266-f2560680da0e",
    104.       "path": "<Keyboard>/s",
    105.       "interactions": "",
    106.       "processors": ""
    107.     },
    108.     {
    109.       "action": "Player/MovementKeyboard1",
    110.       "id": "fdaad742-6084-40f2-8e00-be178efc24ab",
    111.       "path": "<Keyboard>/x",
    112.       "interactions": "",
    113.       "processors": ""
    114.     },
    115.     {
    116.       "action": "Player/MovementKeyboard1",
    117.       "id": "5b093a4a-cae2-4c72-8ecf-0280c204945a",
    118.       "path": "<Keyboard>/z",
    119.       "interactions": "",
    120.       "processors": ""
    121.     },
    122.     {
    123.       "action": "Player/MovementKeyboard1",
    124.       "id": "d45c0085-0eac-4494-9e81-c83936e733a2",
    125.       "path": "<Keyboard>/c",
    126.       "interactions": "",
    127.       "processors": ""
    128.     }
    129.   ]
    130. }
    RESOLVED :

    I had to change the RebindSaveLoad to add a string field so it doesn't save the bindings as a hardcoded string. I had multiple RebindSaveLoad.cs on my scene and they were overriding each other.
     
    Last edited: Aug 10, 2022
  2. SkmaestroF22

    SkmaestroF22

    Joined:
    Aug 29, 2015
    Posts:
    4
    +1 actual trouble
     
  3. OMGOMGXAXA

    OMGOMGXAXA

    Joined:
    Apr 2, 2016
    Posts:
    10
    Hello, it seems to be related. One of my player (steam) have this in the begining of his log and can't use the input system :

    Code (CSharp):
    1.   at UnityEngine.InputSystem.InputActionRebindingExtensions.LoadBindingOverridesFromJsonInternal (UnityEngine.InputSystem.IInputActionCollection2 actions, System.String json) [0x0008f] in <82caec739eb741dd919e67ecbdb434a5>:0
    2.   at UnityEngine.InputSystem.InputActionRebindingExtensions.LoadBindingOverridesFromJson (UnityEngine.InputSystem.IInputActionCollection2 actions, System.String json, System.Boolean removeExisting) [0x0001d] in <82caec739eb741dd919e67ecbdb434a5>:0
    3.   at InputManager.OnNewBind () [0x00015] in <117c75a49d4f4b869fbe1ca10be52844>:0
    4.   at InputManager.Awake () [0x0001c] in <117c75a49d4f4b869fbe1ca10be52844>:0