Hey, another head-scratcher. I’ve “successfully” integrated the new Input System into my project, and for the most part (knock on wood) everything is working. I noticed some odd behaviour though: If I don’t rebind any controls during a play session, everything is great. If I rebind an action to a different input/button, it calls multiple times (Specifically, I am calling "if (controls.Player.Attack.triggered) ).
I’ll also just add, all the relevant actions in the ActionMaps are just type of Button, with no interactions (adding the Press Only interaction doesn’t change the problem, as I guess that’s the default state for a button anyways?)
On a controller or keyboard, if I just tap the button quickly it preforms as expected. If I hold the button down for any longer than just a tap, I see an event called when the button is released as well. It’s far worse with a controller trigger pull, which sees an inconsistent number of between 2 to 4 calls on activation, and another 3 to 5 on release.
Any insight would be appreciated! I do have the following code in my ControlsManager script, though I’m currently only making use of the “canceled” / is_Pressed=false lines. Would I have better luck if I asked for input based on the is_Pressed line? I think I was trying this and ran into issues previously, hence why I’m currently calling on the triggered event.
controls.Player.Ability1.started += context => Ability1_Pressed = true;
controls.Player.Ability1.performed += context => Ability1_Pressed = true;
controls.Player.Ability1.canceled += context => Ability1_Pressed = false;
It’s just super odd that it only happens after a rebind operation has occured, I’ve tried looking through my InputActionMaps and can’t really come up with any reason for this behaviour.
The code for my rebinding script is below (Caution: Extremely inexperienced and uneducated human, I apologize if any of this is ultra gross )
public void RemapAction()
{
//print("TODO: Display "Enter New Key For This Action" Tooltip");
ControlsManager.controlMan.controls.Player.Disable();
rebindOperation = actionToRebind.PerformInteractiveRebinding()
.WithControlsExcluding("Mouse")
.OnMatchWaitForAnother(0.1f)
.Start();
rebindOperation.OnApplyBinding((rebindingOperation, path) =>
{
actionToRebind.ApplyBindingOverride(path);
});
ShowNewBind = true;
}
and further down after some UI stuff;
if (rebindOperation !=null)
{
if (Player2Rebind == false)
{
if (rebindOperation.completed && ShowNewBind == true)
{
//Update Binding Graphic / String
var bindingIndex = actionToRebind.GetBindingIndex();
ControlsManager.controlMan.controls.Player.Enable();
rebindOperation.OnApplyBinding((rebindingOperation, path) =>
{
actionToRebind.ApplyBindingOverride(path);
});
rebindOperation.Dispose();
CurrentBinding.text = actionToRebind.GetBindingDisplayString(bindingIndex, InputBinding.DisplayStringOptions.DontIncludeInteractions);
ShowNewBind = false;
ControlsManager.controlMan.BindingRefresh();
if ((currentSelected.name == "grab") && isGamepad == true)
{
GrabBinding.text = Grab_GP.text + " +";
}
else if ((currentSelected.name == "grab") && isGamepad == false)
{
GrabBinding.text = Grab_KB.text + " +";
}
}
}
}