- Home /
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?
Answer by dan3u · Jul 22, 2019 at 07:33 PM
Same problem, no answers found. If you did fix it, can you show me how you did? @Codelyoko363
Your answer
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
NPC walk animation 3 Answers
2D eyes on 3D character? 2 Answers
How they doing the animations with a ball in a soccer game? 1 Answer
Animating 3d textures 0 Answers