# Needing Logic Help - Character Input

Hey everyone,

I followed a tutorial for some character input mechanics that improve the feel of my inputs and i am really enjoying the outcome. However, there is an issue that i can double jump when i click the button very quickly. I can solve it by decreasing the hang time to 0.08f (that is the highest i can put it without allowing the double jump) but the tutorial and other readings said 0.20f is a good amount of forgiveness. I can learn to live with the 0.08f but it doesn’t leave a lot of margin for error so i thought i’d try to add some bool or minor logic tweak to disable that double jump but still leave me a hang time of 0.20f.

Any help is appreciated. And if i am SOL unless i change majorly, then so be it.

``````void Update()
{
isGrounded = Physics2D.OverlapCircle(groundCheckPoint.position, 0.1f, whatIsGround) || Physics2D.OverlapCircle(groundCheckPoint2.position, 0.1f, whatIsGround);

//Manage hang time for coyote jump
if (isGrounded)
{
hangCounter = hangTime;
}
else
{
hangCounter -= Time.deltaTime;
}

//manage jump buffer
if(CrossPlatformInputManager.GetButtonDown("Jump") || Input.GetButtonDown("Jump"))
{
jumpBufferCount = jumpBufferLength;
}
else
{
jumpBufferCount -= Time.deltaTime;
}

//Handles the actual physics of jumping
if(jumpBufferCount >= 0 && hangCounter > 0f)
{
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
jumpBufferCount = 0;
}

//decrease vertical velocity when button is released
if(CrossPlatformInputManager.GetButtonUp("Jump") && rb.velocity.y > 0)
{
rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * 0.5f);
}
}
``````

I’m not sure I understand exactly what your issue is and what you are trying to do. Do you WANT to double jump or are you trying to prevent it?

Also, with logic like the above it might be best to print out a single line of text each Update() to display booleans, counters, timers, input key values, etc., and from that perhaps discover what’s happening.

And as usual, in general to help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.