Jump delay??

I’ve searched the entire web to find a solution for this. I’m using a C# script and I can’t get a jump delay. Here’s the jump part of my script :

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        if (CanJump == true)
        {
            if (CanJump == true)
            {
                if (CanJump == true)
                {
                    CanJump = false;
                    rigbody.AddForce(new Vector3(0, 5, 0), ForceMode.Impulse);
                    Invoke("resetIsJumping", 3);
                }
            }
        }
    }

void resetIsJumping()
{
    CanJump = true;
}

}

Your script works fine for me. Maybe you need to make sure that when the game starts, CanJump is set to true. If it is set to false in any other way after the delay time, it will remain off.

For example, you could add this before the Update function:

void Awake()
{
	CanJump = true;
}