Slow Fall On Press When Jumping

Ello all. I’m using this here script for character movement

I’ve tried a few things, but they seem to be a bit buggy. What I want to do is essentially that, if not grounded (all ready a variable in the script), if you hold the jump button again your gravity (also a variable) will half. This is the hack I tried with it, but there are a few problems, including that your gravity can randomly double when jumping normally. Even for a miniscule second, this can have big affects.

if (!grounded) {

		if (Input.GetButtonDown("Jump")) {
			gravity = gravity / 2;

		if (Input.GetButtonUp("Jump")) {
			gravity = gravity * 2;

So any help in this matter will help bring me closer to a playable state for my prototype. Thanks!

Well, The problem is that when you jump normally, you are first in a “grounded” state, which won’t trigger the Gravity reduction. But when you release it, It will apply the gravity augmentation, unless you wait till you hit the ground to release it.

What I suggest you do is :

First, Set different constants for gravity. or actually, calculate them and store them in variables at the beginning. and make sure those never change

normalGravity = gravity;
lightGravity = gravity/2;

Also, change the GetButtonDown to the plain GetButton, Which is true as long as the button is held down.

so, your code will look like :

if (!grounded) {
	if (Input.GetButton("Jump")) {
		gravity = lightGravity;
	else {
		gravity = normalGravity;

Also, Remember to set Gravity back to normal every time he hits the ground.