I’m currently working on an on-rails flight game, and I’ve set about a trigger zone for the boundaries on the stage. At the left-most boundary, when a trigger collision is detected, a message is sent to the ship’s control script; this informs the ship to do the following;
Trigger the “crashed” method for 0.2 seconds; users cannot enter any input when their ship is “crashed”, effectively disabling the controls.
A force is applied to the ship, to nudge it away from the boundary
Input.ResetInputAxes(); is called, to prevent against the player from repeatedly “bumping” up against the boundary.
Moving left is disabled for the duration that the player is touching off the boundary - allowing them to only move right (out of the boundary zone), and up/down.
However, none of these appear to work - until the player stops moving. If the player holds down the button to move left, they will run straight through the boundary - with no attempt made by Unity to proceed with the ResetInputAxes call, or disable the controls temporarily.
If the player stops moving (rather, stops holding down the button to move left), then Unity will recognise the script, and will prevent any additional movement towards the boundary.
It’s as if Unity cannot run the ResetInputAxes method, nor check the conditionals for movement, while the player is moving. Throwing in a quick print/debug.log call shows that the method itself runs fine; but it’s like ResetInputAxes is queued on a stack until the player stops moving themselves.
Would anyone have any ideas on what could possibly cause this?