Why does this script only play like 0.3% of my animation

Hi Guys I’m using

function Update()
{
 if(Input.GetKeyDown("1"))
 {
  // Plays the animation - stops all other animations
  animation.Play("attack 1", PlayMode.StopAll);
 }
}

This Script Plays The Animation but it only plays like 2 frames then stops… is there a way to make a public Variable to adjust how long it will play so i can zone on the correct amount of frames? or is there anyway to force it to play all not just 2 frames.

Only way i can get it to play is to spam “1” but makes it SOOO Choppy and that doesnt really look good.

Well, when you start an animation with Play it will play the animation. The only reasons for this behaviour i can think of would be:

  • You overwrite the animation somewhere else, maybe in another script.
  • The bounds of your model is wrong, so Unity thinks it’s not visible. Try to set the cullingType to AlwaysAnimate. If it plays you’re model has messed up bounds which should be fixed.
  • Make sure you don’t have set your timescale to 0.0.