Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rebinding doesn't work?

Discussion in 'Input System' started by matijas_05, Feb 5, 2019.

  1. matijas_05

    matijas_05

    Joined:
    May 8, 2017
    Posts:
    11
    Lately I've been prototyping a new way to rebind keys using the new input system and I think I've encoutered a bug. Running this code:
    actionReference.action.ApplyBindingOverride(0, "<Keyboard>/u");
    throws an assertion failed exception:

    Code (CSharp):
    1. Assertion failed
    2. UnityEngine.Experimental.Input.InputActionRebindingExtensions:ApplyBindingOverride(InputAction, Int32, String)
    3. [...]
    Here is the picture of the binding that I'm trying to rebind.
    Adnotacja 2019-02-05 170905.jpg
     
  2. DavidGrof

    DavidGrof

    Joined:
    Sep 13, 2016
    Posts:
    24
  3. DavidGrof

    DavidGrof

    Joined:
    Sep 13, 2016
    Posts:
    24
    Think it will be faster if we manually update the json :p
     
  4. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Have trouble reproducing this. @matijas_05 Could you paste me the full text from the Editor.log when you encounter the problem? There should have a full stack trace along with the assert.
     
  5. matijas_05

    matijas_05

    Joined:
    May 8, 2017
    Posts:
    11
    Of course.

    Code (CSharp):
    1. Assertion failed
    2. UnityEngine.DebugLogHandler:Internal_Log()
    3. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    4. UnityEngine.Logger:Log(LogType, Object)
    5. UnityEngine.Debug:Assert(Boolean)
    6. UnityEngine.Experimental.Input.InputActionMap:InvalidateResolvedData() (at Library\PackageCache\com.unity.inputsystem@0.1.2-preview\InputSystem\Actions\InputActionMap.cs:697)
    7. UnityEngine.Experimental.Input.InputActionRebindingExtensions:ApplyBindingOverride(InputActionMap, Int32, InputBinding) (at Library\PackageCache\com.unity.inputsystem@0.1.2-preview\InputSystem\Actions\InputActionRebindingExtensions.cs:163)
    8. UnityEngine.Experimental.Input.InputActionRebindingExtensions:ApplyBindingOverride(InputAction, Int32, InputBinding) (at Library\PackageCache\com.unity.inputsystem@0.1.2-preview\InputSystem\Actions\InputActionRebindingExtensions.cs:94)
    9. UnityEngine.Experimental.Input.InputActionRebindingExtensions:ApplyBindingOverride(InputAction, Int32, String) (at Library\PackageCache\com.unity.inputsystem@0.1.2-preview\InputSystem\Actions\InputActionRebindingExtensions.cs:108)
    10. Game.NewInputSystem.KeyBinding:AssignCompositeControl(Int32) (at Assets\_Scripts\Key Bindings\KeyBinding.cs:405)
    11. UnityEngine.Events.InvokableCall`1:Invoke(Int32) (at C:\buildslave\unity\build\Runtime\Export\UnityEvent.cs:207)
    12. UnityEngine.Events.UnityEvent`1:Invoke(Int32) (at C:\buildslave\unity\build\Runtime\Export\UnityEvent_1.cs:58)
    13. Game.UI.ArrowSelection:NextOption() (at Assets\_Scripts\UI\ArrowSelection.cs:46)
    14. UnityEngine.Events.InvokableCall:Invoke() (at C:\buildslave\unity\build\Runtime\Export\UnityEvent.cs:166)
    15. UnityEngine.Events.UnityEvent:Invoke() (at C:\buildslave\unity\build\Runtime\Export\UnityEvent_0.cs:58)
    16. UnityEngine.UI.Button:Press() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\UI\Core\Button.cs:66)
    17. UnityEngine.UI.Button:OnPointerClick(PointerEventData) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\UI\Core\Button.cs:108)
    18. UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\ExecuteEvents.cs:50)
    19. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\ExecuteEvents.cs:261)
    20. UnityEngine.EventSystems.StandaloneInputModule:ProcessMousePress(MouseButtonEventData) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:613)
    21. UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:510)
    22. UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:490)
    23. UnityEngine.EventSystems.StandaloneInputModule:Process() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:254)
    24. UnityEngine.EventSystems.EventSystem:Update() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\EventSystem.cs:377)
     
  6. darkal

    darkal

    Joined:
    Jun 13, 2013
    Posts:
    7
    any updates on this?
     
  7. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    0.1.2 is a super old version. Are you on 2018.4 by chance? I expect this is fixed as of 1.0.0-preview.5 (which, however, requires 2019.1 as a min version).
     
  8. darkal

    darkal

    Joined:
    Jun 13, 2013
    Posts:
    7
    @Rene-Damm is it possible have a simple code example to rebind a key from a keyboard key to event current input such as mouse0 or joystick etc?
     
  9. darkal

    darkal

    Joined:
    Jun 13, 2013
    Posts:
    7
    I am using 2019.3.1f1 and Input System preview.5 1.0.0