How to make player detect when on ground and when lands on ground

I am making a 2D platformer and I’m having trouble making the player be able to jump. How can I make my player detect when he’s on the ground so he can jump? How can he detect when he lands on ground after jumping for a landing animation?

I need to make this Platform Effector proof

There are generally two ways to do this. You could attach Colliders on the feet of your character and use them as triggers, checking when they intersect with the floor. Or, you could use RayCast2D to find out how far away the floor is from the feet of your character (by casting rays downward from their feet).

You can use a bool variable in OnCollisionStay method and when it is in collision with ground make that variable to be true else make it false.

@Raja-Unity This is the best way I found to check for landing. All you have to do is make sure you call CheckLand() in Update before CheckAirTIme()

Blockquote

private void CheckAirTime() 
{
    if (charController.isGrounded)
    {
        airTime = 0f;
    }
    else
    {
        airTime += Time.deltaTime;
    }
}

private void CheckLand()
{
    if (airTime > 0)
    {
        if (charController.isGrounded)
        {
            //Debug.Log("Landed");
        }
    }
}