Animation and Key binding problem

Hi,

Im new new here, the problem i have is that i cant get proper key binding on fighting animations, i want to bind one key to standed stright punch and crouched stright punch animations and i done this with new input system on xbox controller but i cant get both animations working as only one is going.I cant find a solution for this for over a week now,:smile: Would appreciate any help i could get! Is there something as simpe as:

void punch(){
     if (anim.Play("stand"))
    {
        anim.Play("standedpunch");
        }
else if (anim.Play("crouch"))
    {
        anim.Play("crouchedpunch");
        }
}

You are checking what animation is playing wrongly.

Instead of:
if (anim.Play("stand"))
You should use:
if (anim.isPlaying("stand"))

That will return either true or false.

Check the documentation for more information: Unity - Scripting API: Animation

Thanks mate, but solution i found :

if (anim.GetCurrentAnimatorStateInfo(0).IsName("stand"))
        {
            anim.Play("standedpunch");
        }
        else if (anim.GetCurrentAnimatorStateInfo(0).IsName("crouch"))
        {
            anim.Play("crouchedpunch");
        }