::Some of our commenters in the Youtube series have pointed out that dashing into an enemy causes the game to freeze. This is happening due to the hit stop mechanic where time slows down when the player gets hit which acts as feedback for the player telling them that they’ve been hit.
Due to the player being in the dashing state when the player gets hit, the RestoreTimeScale()
method, which moves the Time.timeScale value back to 1. does not get called in the Update()
function.
To fix this all we have to do is move where we call the RestoreTimeScale()
method up and above the if(pState.dashing) return;
line so that RestoreTimeScale()
will be called before the return
statement.