Hello Guest

Author Topic: Stop Animation At Last Frame  (Read 5023 times)

Tylernocks

  • Newbie
  • *
  • Posts: 15
    • View Profile
Stop Animation At Last Frame
« 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Stop Animation At Last Frame
« Reply #1 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.

Tylernocks

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Stop Animation At Last Frame
« Reply #2 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.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Stop Animation At Last Frame
« Reply #3 on: May 09, 2013, 09:42:26 am »
Apologies. That was a typo. I meant to type Once, not Single.

Tylernocks

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Stop Animation At Last Frame
« Reply #4 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Stop Animation At Last Frame
« Reply #5 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.

Tylernocks

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Stop Animation At Last Frame
« Reply #6 on: May 09, 2013, 10:43:41 pm »
It worked YES!!!! Best support ever!!!