- Home /
Touch not changing variables, Keypress does
Hey there!
For some background information: Whenever I touch a certain area, a Raycast is sent from the camera to the screen, detecting if it touches certain layers. That works very well and responds fast.
For my jumping, I'm checking if the player is grounded, if is that is the case, the player's velocity.y is changed to my maxJumpVelocity, resulting in a jump.
When playing the game with the keyboard, everything works as intended. The Debug.Log function in the Jump() method is called every time when I'm pressing the space key and the player jumps. However, when I'm just touching the screen, the method gets called (so I see the Log etc..) but the velocity is not changed whatsoever, resulting in no jumps!
So, the method is called, and it should be changed but it isn't, And I'm quite baffled to be honest, because there should be no mistakes at all.
Would be super cool if anyone knows something about this phenomenon.
Cheers.
I recommend posting a code snippet if you are still having this issue so it is a bit clearer and easier to see what is going wrong.
Your answer
Follow this Question
Related Questions
Placing a Rect and detecting a Touch/Tap 1 Answer
Distribute terrain in zones 3 Answers
Android player crashes on startup 1 Answer
Script for jump when screen is touched (C#) 1 Answer
Store/Stack Items 0 Answers