Input.getKeyDown, behaving very weirdly on one of my scripts

So i am doing a very basic platformer, and i’m currently tring to make it so, that if you hold UpArrow then you can float for a certain amount of time. Now everything works fine, except for the input, wich is driving me god damn insane. For some unknown reason, in my Hover script, it just doesn’t want to accept input proberly. I’ve moved to different scripts, restarted unity, and my computer. slowly build it all up from a new script. and nope. when i press UpArrow, only if im on ground, wich is where i don’t need it at all, does it behave consistenly, giving me the debug message of “BANANA”. However, when i’m in air, alot of times, it just doesn’t get the input, and it sometimes has lengthy periods of time, where it NEVER gets the input. AND, if i hold down space, wich is the jump key in my game, it NEVER gets the input. i’m completly lost and very frustrated.`using UnityEngine;
using System.Collections;

public class inpuuttest : MonoBehaviour {

Rigidbody2D character;

public Transform groundCheck;
public float groundCheckRadius;
public LayerMask ground;
private bool grounded;

float oldY;
bool hoverDelayOn = false;
public int hoverDelayTicks = 30;
int hoverwait = 0;
bool hovering;
bool hoverDecision = true;

private float debugger = 0;

void Start () {
	character = GetComponent<Rigidbody2D> ();
}

void Update () {

	if (hoverDelayOn == true) {
		hoverwait += 1;
		if (hoverwait == hoverDelayTicks) {
			hoverDecision = false;
			hoverDelayOn = false;
			hoverwait = 0;
		}
	}

	//  HERE IS WHERE THE BIG PROBLEM ARRISES. AS YOU CAN SEE I'VE SET A DEBUG.LOG BEFORE THE SECOND IF STATEMENT. YET THIS DEBUG LOG SAYING "BANANA" SIMPLY ACTIVATES VERY RARELY, AND ALOT OF TIMES NOTHING HAPPENS.
		if (Input.GetKeyDown ("up")) {
		    Debug.Log (debugger + "BANANA");
			if(hoverDecision == true) {
				hoverDelayOn = true;
				debugger += 1;
			    Debug.Log (debugger);
			}
		}

		if (Input.GetButton ("UpArrow")) {
			if (hoverDecision == true) {

			character.velocity = new Vector2 (character.velocity.x, 0);

			}
		
		}

		if (Input.GetButtonUp ("UpArrow")) {

			hoverDecision = false;
			hovering = false;

	
			if (grounded == true) {
			
				hoverDecision = true;
				hoverDelayOn = false;
				hoverwait = 0;

			}

		}
	}

void FixedUpdate () {
	grounded = Physics2D.OverlapCircle (groundCheck.position, groundCheckRadius, ground);
    }

} `

If you press UpArrow while on ground you will start hovering. Now if you press up. You will get banana debug and hoverDelay will start working.

But after first step if you decide to release UpArrow key. Force will stop and player will start descending. And then if you decide to hover again i.e. is press UpArrow key. It won’t work because hoverdecision becomes false and can only be true while on Ground. Thus pressing up won’t print Banana too since HoverDecision is false.

 if (grounded == true) {
             
                 hoverDecision = true;
                 hoverDelayOn = false;
                 hoverwait = 0;
 
             }

Making these changes will solve your current problem. I haven’t tested the code.

   if (Input.GetButtonUp ("UpArrow")) {
 
             hoverDecision = false;  // remove this
             hovering = false;       // remove this. i don't see it used anywhere
 
     
             if (grounded == true) {
             
                 hoverDecision = true;
                 hoverDelayOn = false;
                 hoverwait = 0;
 
             }
 
         }