Problem with deltaTime increasing value

Super beginner here, any advice would be greatly appreciated. I’m having an issue where I’d like to increase a value over the time a button is held down. Currently it seems it only makes a fraction of an increase once right after input and stops there. So for example if my base is 5 after pressing my input it increases to 5.03331 and stops there even after continued pressing down.

here’s the basic script

	public float Chargevalue = 5f; 
	
	void Update () {
	
		if(Input.GetButtonDown("Jump"))
		   
			Chargevalue += Time.deltaTime * 2;
		

		else if(Input.GetButtonUp("Jump"))
		        Chargevalue = 5f; //resetting the value

I’ve tried in both Update and FixedUpdate and different input variations, not sure how to get it to read continual input. Any thoughts?

Sounds like you want Input.GetButton.

  • GetButton returns true for each frame while button is pressed
  • GetButtonDown returns true for one frame when it’s pressed
  • GetButtonUp returns true for one frame when it’s released