- Home /
How do I stop player from button hold down?
Hello, I had an issue where I can press a certain button and my player would jump, but the only issue is when you hold the button down the player goes higher although if you tap it the player doesn't go that high. I messed around with the setting a little but the button when held down makes the player go higher. Depending on what I put the numbers too the higher the character goes. (Pictures of script will be below and in replies). If anyone has a fix please help, thanks!
where do you reset jump
to false?
from what you provided as information you do that immediately instead of when colliding with ground.
But once again the issue is that when the player holds the button down it like multiplies it, but if you hardly tap it the player jumps like a couple of inches. When I mess with the numbers it will change but I want it to be where you press it and the player jumps a certain height and cant jump again until the player hits the grounds and that's it.
i will thus ask once more: where do you reset jump
to false?
If you are using the traditional api then there are down variants of the events... i.e. GetButton and GetButtonDown. Are you using the Down variant?
https://docs.unity3d.com/ScriptReference/Input.GetButtonDown.html https://docs.unity3d.com/ScriptReference/Input.GetKeyDown.html https://docs.unity3d.com/ScriptReference/Input.GetMouseButtonDown.html