Forum rules - please read before posting.

JSON error with InputSystem integration

I have this show-stopper when I include the global string variable InputRebind in the ControlsReader gameobject.

There's no error when the variable is only entered in the ControlsReader prefab. But obviously it won't save runtime rebindings if the gameobject is not linked. (Latest AC, U2022.1.20)

ArgumentException: JSON must represent an object type.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at <2db9f335cf0a4e6a9baae70d3f2f5ca3>:0)
UnityEngine.JsonUtility.FromJson[T] (System.String json) (at <2db9f335cf0a4e6a9baae70d3f2f5ca3>:0)
UnityEngine.InputSystem.InputActionRebindingExtensions.LoadBindingOverridesFromJsonInternal (UnityEngine.InputSystem.IInputActionCollection2 actions, System.String json) (at Library/PackageCache/com.unity.inputsystem@1.4.4/InputSystem/Actions/InputActionRebindingExtensions.cs:1256)
UnityEngine.InputSystem.InputActionRebindingExtensions.LoadBindingOverridesFromJson (UnityEngine.InputSystem.IInputActionCollection2 actions, System.String json, System.Boolean removeExisting) (at Library/PackageCache/com.unity.inputsystem@1.4.4/InputSystem/Actions/InputActionRebindingExtensions.cs:1202)
AC.ControlsReader.LoadRebindings () (at Assets/AdventureCreator/Downloads/Input System integration/ControlsReader.cs:219)
AC.ControlsReader.OnInitialiseScene () (at Assets/AdventureCreator/Downloads/Input System integration/ControlsReader.cs:200)
AC.EventManager.Call_OnInitialiseScene () (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:1958)
AC.SaveSystem.InitAfterLoad () (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:655)
AC.MultiSceneChecker.RunStartProcess () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:123)
AC.MultiSceneChecker.Start () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:55)


  • What's your Input System package version?

    I've made a slight adjustment to the ControlsReader script. Re-download and re-import the file (others can be ignored) from the package - does the issue persist?

  • Thanks. Yes, the JSON error persists, pointing to lines 219-22 in the file:

    if (!string.IsNullOrEmpty (saveVariable.TextValue))
    actions.LoadBindingOverridesFromJson (saveVariable.TextValue);

    Input System version is 1.4.4 which came out just a week ago(?). Should I revert to 1.4.3 or older?

  • And now there's also this:

  • OK I tried everything, this is clearly a bug. It may be 1.4.4 related -- but wouldn't like to revert to 1.4.3 if I can help it, as the upcoming U2022.2 will auto-update to 1.4.4 anyway.

  • the JSON error persists

    Replace line 217:

    if (saveVariable != null && saveVariable.type == VariableType.String)


    if (saveVariable != null && saveVariable.type == VariableType.String && !string.IsNullOrEmpty (saveVariable.TextValue))

    And now there's also this

    That looks like an issue with Input System, since the Controls script the errors reference is generated by the Controls input asset. You may want to try deleting the script file, and re-generating it within the input asset window.

  • edited November 2022

    Same error persists with new line. Though it points to line 221 only.

    Regenerating the Controls.cs did solve the other issue.

  • edited November 2022

    Can you share the error in full - stacktrace included?

    I can't recreate such an issue. If you check "Show realtime values?" in the Variables Manager, what is the value of the String variable you're linking to at the time the error shows?

  • I tried with an empty project, and it works. So once again it's a local interference, will need to clean my project.

  • In fact, further investigation suggests that using anything more recent than the LTS is really problematic with AC, especially if UCC (and the integration) is also present.
    The 2022 tech stream is ridiculously broken, and Opsive's stuff, for instance, is really sensitive to these discrepancies.

  • If you have encountered an issue with AC and a particular Unity version, please share details.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.