TheNathannator / PlasticBand-Unity

A package for the Unity InputSystem package that provides mappings and classes for Rock Band and Guitar Hero peripherals
MIT License
5 stars 2 forks source link

when a control has multiple bindings, PerformInteractiveRebinding always prefers the more general one #8

Open MatteoGodzilla opened 1 year ago

MatteoGodzilla commented 1 year ago

Unity Version: 2022.2.17f1 PlasticBand-Unity Version: main branch (commit 202dfc52cb03fb610d3b4738b6ca29814654df2b)

At the moment the bindings provided by PlasticBand are not considered by PerformInteractiveRebinding, so the remapping still works but it will use the corresponding generic button that is under the "Joystick" or "Gamepad" category. This is not ideal, since it can lead to cases where the player accidentally rebinds an action with the same phisical button, changing the binding from PlasticBand to a generic Unity binding.

Probably related: using 'Listen' in the unity input map editor while setting the bindings for an action will not list the ones provided by PlasticBand.

Unity sample scene that shows this issue

TheNathannator commented 1 year ago

Are you just referring to some controls corresponding to the same inputs? None of the PlasticBand-Unity device layouts inherit from Gamepad or Joystick, and the input system only chooses one layout for any given device, so I'm not sure where these generic buttons are coming from if they're not the ones already on the instrument layouts.

I do need to rework the control hierarchy so this doesn't happen lol, bad design decision on my part. Things like strumming and d-pad up/down on guitars or the face buttons and pad on drums use the same state data and will cause this issue to happen.

We avoided this issue in YARG by implementing our own binding system and allowing the user to pick which control to use if multiple became active at once, but the problem existing in the first place is not ideal.

MatteoGodzilla commented 1 year ago

when testing with a ps3 turntable rebinding to any of the turntable buttons is impossible because the standard ps3 face buttons (square, cross, circle and triangle) have priority. When seeing "cross" appear i thought it was coming from the default gamepad, but i was wrong. It is picking it up from plasticband.

Still, the fact that it's binding to <Turntable>/buttonSouth instead of <Turntable>/rightTableGreen could cause some issues when trying to bind a double table setup.

MatteoGodzilla commented 1 year ago

Another issue that has just popped up while testing is axis-controls like crossfader, effects dial and turntable speed cannot be rebound at all with this function. If they are set from the unity input actions editor they work, but changing to something else and then trying to rebind them does not work

TheNathannator commented 1 year ago

Hm, not sure what would be going on with axis controls, those aren't doing anything funky like the buttons are. I haven't touched the interactive rebinding stuff yet, will see what I can work out.

TheNathannator commented 1 year ago

I think you'll be happy to hear that I've finally got a solution to the conflicts that I can implement sanely lol

I worked out how to handle state data manually regardless of how state events get handled (InputSystem.onEvent, InputState.onChange, input actions, state change listeners, etc.), so now I can do whatever is needed to fix up the input reports before they actually get used.

Previously I wasn't able to do this without possibly breaking some use cases because InputSystem.onEvent is fired before a device can handle its state manually, but I recently figured out all of the input control extensions involving state will call into a method on the interface that lets a device handle state manually, which means I can still do manual state handling and fixups regardless of what path the state event takes.

Some of these conflicts I can resolve without this ability, but others I'd have to create tons of specialized control types for just so I can ignore a control if another is active or just so I can correlate multiple bits of state data together (can't pass string parameters to controls to name specific controls to access, so I'd have to hardcode each and every name in its own variant). Drums in particular are just a pain to handle correctly otherwise, they've got a lot of this going on lol

I'm still not sure why interactive rebinding ignores axis controls, but that's probably a configuration error or something else out of my control. Still need to play around with that to learn how it works.

TheNathannator commented 1 year ago

New version v0.4.0 should fix a majority of these issues, if you get around to trying it lemme know!