I am using the new input system but I cannot seem to get the mouse clicks to behave correctly.
Im trying to implement an attack with the left mouse button. I created the action and it is firing, but the value never turns back to false.
public void OnSprint(InputValue value)
{
SprintInput(value.isPressed);
}
public void OnAttack(InputValue value)
{
AttackInput(value.isPressed);
}
Why is the sprint working normally, when pressed it goes to true, and when released it fires a new event saying the value is false.
However the mouse attack only returns true and then never goes back to false. There is no event fired when I release the left mouse button.
CodePudding user response:
Try changing it to AttackInput(value.isReleased), and change it so it fires when false.
CodePudding user response:
The new input system is event driven/focused, unlike the old Input class.
Hook into the canceled
event of the input.
inputs.Attack.canceled = (ctx) => StopAttacking();