Search Unity

Bug InputAction.AddCompositeBinding causing errors.

Discussion in 'Input System' started by Plybs, May 30, 2023.

  1. Plybs

    Plybs

    Joined:
    Jan 22, 2021
    Posts:
    7
    I'm going crazy here. I'm trying to bind controls at runtime and found this method in the documentation:

    Code (CSharp):
    1. moveAction.AddCompositeBinding("2DVector")
    2.             .With("Up", "<Keyboard>/w")
    3.             .With("Down", "<Keyboard>/s")
    4.             .With("Left", "<Keyboard>/a")
    5.             .With("Right", "<Keyboard>/d");
    It works as expected for every key except the "Right" action, which is not registered and throws these errors:

    UError.png

    This problem persists no matter what key codes are entered (they were bound to the arrow keys when that image was captured).

    Oddly if you duplicate the assignment of the "Right" action;

    Code (CSharp):
    1. moveAction.AddCompositeBinding("2DVector")
    2.             .With("Up", "<Keyboard>/w")
    3.             .With("Down", "<Keyboard>/s")
    4.             .With("Left", "<Keyboard>/a")
    5.             .With("Right", "<Keyboard>/d")
    6.             .With("Right", "<Keyboard>/d");
    It behaves as expected, but still throws the same errors when the "Right" action is pressed.
    It seems this is a problem with the input system code itself, unless there's something I'm missing that wasn't included in the documentation.
     
  2. Plybs

    Plybs

    Joined:
    Jan 22, 2021
    Posts:
    7
    Update:

    Adding another binding to the input action asset seems to fix the problem, but I will be leaving this up as it's still a bug, one of many that make the Input System feel overall unpolished.