2D Toolkit Forum

2D Toolkit => Support => Topic started by: Tylernocks on May 08, 2013, 06:26:17 am

Title: Stop Animation At Last Frame
Post by: Tylernocks on May 08, 2013, 06:26:17 am
I have a death animation, I want for when it meets its last frame for it to remain on the frame until it get re-called
Title: Re: Stop Animation At Last Frame
Post by: unikronsoftware on May 08, 2013, 09:41:07 am
If you set the animation clip loop type to single, thats exactly what will happen - it will stop at the last frame.
Title: Re: Stop Animation At Last Frame
Post by: Tylernocks on May 09, 2013, 03:04:17 am
How do you do that, changing the wrap mode to single reduced it to the one frame only. I want the animation to play but just stop at the last frame and not loop.
Title: Re: Stop Animation At Last Frame
Post by: unikronsoftware on May 09, 2013, 09:42:26 am
Apologies. That was a typo. I meant to type Once, not Single.
Title: Re: Stop Animation At Last Frame
Post by: Tylernocks on May 09, 2013, 10:19:57 pm
hmmm...seems that didnt work either, I set it to once but it still loops
here's the script
Code: [Select]
State = CharacterState.Dead;

if (!anim.IsPlaying("Death"))
{
anim.Play("Death");
}

The wrap mode is set to once
Title: Re: Stop Animation At Last Frame
Post by: unikronsoftware on May 09, 2013, 10:21:45 pm
If you're calling this from Update, your code will restart the animation every time it stops playing... You need to only call Play once when you switch to the CharacterState.Dead state.
Title: Re: Stop Animation At Last Frame
Post by: Tylernocks on May 09, 2013, 10:43:41 pm
It worked YES!!!! Best support ever!!!