Animation doesn't play when called with script

I have two animations and i want the default animation to change to another when my enemy enters a different state. So i added this code:

case BossStates.Idle:

                if (Input.GetKey(KeyCode.G)) {

                    bossState = BossStates.SpinAttack;
                }

                         
                break;

            case BossStates.SpinAttack:
                timer = timer - Time.deltaTime * delayTime;


                anim.Play("SpinAttack",-1,0f);


                


                break;

My Enemy is meant to change states when i press G just for testing purposes so when i press G it’s meant to change to the “SpinAttack” Animation but it doesn’t and i can’t understand why. Instead of playing the whole animation, it just resets to the start of the animation and doesn’t play but it looks like it’s trying to play shown by this:

I just don’t understand what’s wrong :(.

Can anyone help me?

Same problem, no answers found. If you did fix it, can you show me how you did?
@Codelyoko363