- Home /
Why won't my animation play?
Hello! I am new to Unity and have been following many tutorials from YouTube and learning as I go. I recently added a Health Potion to my 2D game and it works as expected, but now whenever my player is damaged the animation I had no longer plays. (When my player got damaged he flashed red). I'm not sure why it isn't playing anymore. The animation is called 'Player_Damaged' and is set to legacy. I am getting no errors but the animation just isn't playing like it used to. If anyone could help me that would be great! Thank you.
I have referenced it in my code here:
public void Damage(int dmg){
currentHP -= dmg;
gameObject.GetComponent<Animation>().Play ("Player_Damaged");
}
hello, what kind of software do you use to make your animation?
i'm using Spine, and to change the animation i use
private SkeletonAnimation skeletonAnimation;
skeletonAnimation.AnimationName = "Run";
Answer by kingnulo · Jul 22, 2018 at 09:43 AM
Hello! Sorry but I actually just solved it haha! It seemed to be a problem where there was a thing in my animation called Animator.Enabled (I don't know how it got there and it wasn't there when I posted the question) but my Unity was crashing whenever the animation played. I deleted this and it started to work again! Bizarre..