EDIT:
Nvm, I just fixed it.
Well, I did some testing before posting and it didn’t work, so that’s why I’m asking for some guidance.
And I didn’t even said it was a bug, I just said that it seems like there’s something in memory that is not being flushed.
As for the Key rollover, I don’t think that’s the case. I tested with 2 keyboards and with both of them, no success.
I checked the player speed and it is indeed changing depending on the boolean, so I believe there doesn’t seem to be something wrong with the way I’m moving. But well, I might be wrong.
I even created a brand new player prefab without some of the original player child objects to test and well, no success.
This is how my Action Maps and Actions are organized:
I have a base InputReader class where I’m creating my GameInput (my input class) instance.
On my MovementInputReader class, I’ve set both OnEnable/OnDisable like this:
protected void OnEnable()
{
base.OnEnable();
gameInput.Player.Move.performed += OnMove;
gameInput.Player.Move.canceled += OnMove;
}
protected void OnDisable()
{
base.OnDisable();
gameInput.Player.Move.performed -= OnMove;
gameInput.Player.Move.canceled -= OnMove;
}
On my BreathControlInputReader, I have the following:
protected void OnEnable()
{
base.OnEnable();
gameInput.Player.BreathControl.performed += OnHoldBreath;
gameInput.Player.BreathControl.canceled += OnRegenerateBreath;
}
protected void OnDisable()
{
base.OnDisable();
gameInput.Player.BreathControl.performed -= OnHoldBreath;
gameInput.Player.BreathControl.canceled -= OnRegenerateBreath;
}
I’m not doing anything complicated for my logic. My MovementController has a FixedUpdate that gets the speed based on the boolean I mentioned before and sets it to true/false whether I’m holding my breath. Then I do some calculations regarding acceleration etc, and move the player using .AddForce().
As far as I’ve checked, everything is working perfectly fine and the calculations are using the right values. But for it to work, I have to release the movement key and press it again.