How can I fix this with my ground check?

So if I use a second collider, to check that the player is grounded or not, then if the collider has the same width as the player, then I can jump up on walls. If the collider’s width is smaller, then I can’t jump at the very edge of the platform. How should I make it then? Is there any way to fix this?

Make a bool called “onGround”.

Then in your OnCollisionEnter use this:

        Vector3 normal = collision.GetContact(0).normal;

        if (normal == Vector3.up)
        {
            onGround = true;
        }

In your OnCollisionExit use this:

onGround = false;

and in your Start use this:

onGround = true;

This will check if the player hit the top side of the object it hit and only then set “onGround” to true.

Now before you jump check if “onGround” is equal to true.