Or statement problem when stringing multiple statements together

 private void FixedUpdate()
    {
        //the first statement should work no matter what because it's already been previously tested alone
        if (Physics.OverlapSphere(groundCheckTransform.position, 0.1f, playerMask).Length == 0
        || (Physics.OverlapSphere(groundCheckTransformFront.position, 0.1f, playerMask).Length == 0)
        || (Physics.OverlapSphere(groundCheckTransformBack.position, 0.1f, playerMask).Length == 0)
        || (Physics.OverlapSphere(groundCheckTransformTop.position, 0.1f, playerMask).Length == 0))
        {
            return;
        }

        if (jumpKeyWasPressed)
        {
            rigidBoddyComponent.AddForce(Vector3.up * 5, ForceMode.VelocityChange);
            jumpKeyWasPressed = false;
        }

        rigidBoddyComponent.velocity = new Vector3(horizontalInput * 2, rigidBoddyComponent.velocity.y, 0);
    }

nothing happens when I run the game, this is my first time learning c# so I need help.

What did you expect to happen, and why?

A good approach may be to place a couple of Debug.Log(“i was here: xxx”) into the curly braces of the if clauses

1 Like

Thanks that helped a lot, apparently the area I checked was too small. I changed all of them to 1 and it works as it’s supposed to. One other question, how would I create a double jump system?

You’ll need to more clearly describe your expected behavior.

As it is written now, if any of your ground check transforms is not overlapping a playerMask object, the function returns. So it will only run any of the jump code if all four are overlapping the thing. Is that the intended behavior? If not, then you got your logic wrong; if so, then your ground check transforms may be assigned or positioned incorrectly.

They were positioned wrong, how do I mark a answer?