Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Modify Control Usages

Discussion in 'Input System' started by JUSTCAMH, Nov 24, 2019.

  1. JUSTCAMH

    JUSTCAMH

    Joined:
    Dec 8, 2018
    Posts:
    18
    This docs page makes reference to 'Control Usages' and I'd like to modify / create my own. Most notably, I'd like to remove certain controls from a usage.

    I believe that these are causing control conflicts. I've bound the space bar to a jump control, however with a specific combination of inputs (two arrows + space), the jump control is not triggered. This combination does work is the jump control is replaced with something else (i.e. z). I can confirm that this is not an issue with my code; no triggers are coming in at all. Space is probably conflicting with the default UI controls, which use the Submit usage.
     
  2. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    237
    Or it could just be a ghosting problem if you have a "basic" keyboard ?
     
  3. JUSTCAMH

    JUSTCAMH

    Joined:
    Dec 8, 2018
    Posts:
    18
    Could you explain what you mean by that, and how I might fix it?
     
  4. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    237
  5. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    ATM there's no support for modifying usages dynamically like that -- except at the device level. Meaning you can reassign the usages on a device but not on individual controls in a device except by modifying the layout used by the device.

    I do think that having the ability to dynamically reconfigure usages on individual controls could be very useful and the request has come up here and there. It's on the list of things to consider.

    ATM there's no communication that way between the UI and actions used elsewhere so it's unlikely that's the source of the problem.

    That sounds peculiar indeed. I assume the space bar input is coming through just fine in the input debugger? How is the "combination of inputs" set up in your bindings?
     
  6. JUSTCAMH

    JUSTCAMH

    Joined:
    Dec 8, 2018
    Posts:
    18
    Just looked at the input debugger, and the space bar input is not being registered. The space bar is not detected when the left and up arrows are held, but is being detected when the right and up arrows are held (weird). The bindings are standard as far as I know, I've got one control for Jump, bound to z and space (both without processors or interactions). This weird behaviour only arises when using space, and the z control works as expected.
     
  7. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    223
    I have the reverse issue where Space does not Submit in my menu, only Enter does. I want to make Space also bound to the Submit usage. However, the UI usages in the Input Actions Asset don't behave like other actions. Adding the Space input below "Submit [Any]" doesn't make Space submit, like Enter.

    I've read the doc and tried a few things, but it led to nowhere (the example with Player1 seems very hard to adapt; Player1 is a tag to indicate a controller, but they use it as a usage? What do I do with the creation action object?)

    Could you give a complete code snippet to:

    1. Add Space as alternative input to the Submit "usage" action in menus (what I need)
    2. Remove Enter from the list of Submit inputs (or Space if it has been added) (may be useful for users with a similar issue as the OP, where the existing input conflicts with game input)

    Thank you
     
  8. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    223
    Oops, I was still pointing to the Default Input Actions on my Event System's Input System UI Input Module, instead of the custom Input Actions asset I created.

    Using the custom asset, and adding Space as alternative binding to Submit, makes it work as expected.
     
  9. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    If I understand this correctly, if for example, the southButton has the usage Submit there is no way to change that in a script.

    In other words, I can rebind the keys for actions but the UI will not respect the rebinding?

    Yes?

    In an example if I have these actions:
    N
    S

    And these bindings:
    N -> <Gamepad>/southButton
    S -> <Gamepad>/northButton

    Even thought the N and S actions fire correctly the UI will still be using the south button on the gamepad as Submit.

    If so how can I get the UI to respect rebinding such that pressing the north button on the gamepad is the submit button?
     
  10. andrew_oc

    andrew_oc

    Unity Technologies

    Joined:
    Apr 16, 2021
    Posts:
    77
    The UI just uses the Submit *action*. It doesn't care what control it's bound to. So if your players rebind that action to a different control, it should still work fine.