At the beginning of the game, sometimes I press space and nothing happened. Did you put the input detection in FixedUpdate?
If you have time, please take a look at my game, thank you.