Hi guys. Im currently trying to make a plataform 2D game and i came across a problem i cants seem to get an answer for. Im trying to make my character jump if the space bar is pressed and released, but if space bar is pressed and held down, then player has to perform a different action, eg stand idle and play new animation. The problem is that if the jump is activated only after space bar is released it feels unnatural. I was thinking of timing the press of space bar and use something like that to trigger actions. Is there a more efficent way to do this? How would this apply on mobile (input.touch). thanks for your time.
You can always use Time.DeltaTime for the space bar case. Implement some sort of accumulator variable and different tresholds maybe.
For mobile you can check this thread:
Touch has a special parameter deltaTime for this particular problem.
Hope this helps!