Ask a question about judging a jumping and landing situation

Here’s what I wanna do,

I have a character, and I want him to jump, and landing with a landing animation. so…I just wanna ask how can I code a landing situation…I mean, I wasn’t on the ground, and I was falling, then when I just suddenly touch the ground, I can perform a landing animation.

I tried a simple way before like

if(!isGrounded)
{
if(isGrounded)
{
animation;
}
}

and it didn’t work…so seeking for a unity answer here…
thanks for helping!!

boolean jumping = false;

Void Update (){
if(isGrounded){
    if(Input.GetButtonDown("Jump")){
        // Do your jumping here
        jumping = true;
    }
        if(jumping){
            animation.Play("landing");
            jumping = false;
            }
    }
}

It should be something along those lines.

(Code not tested)

Edit: I noticed the C# tag, so I edited the code using C#, however I am not a C# go-to-guy so there might be some errors, but I guess you can fix them yourself.