Search Unity

Stopping the animation at the last frame.

Discussion in 'Scripting' started by ScottyRich, May 19, 2014.

  1. ScottyRich

    ScottyRich

    Joined:
    Oct 7, 2013
    Posts:
    35
    I'm looking to have an in and out animation for when I change held items. It works fine unless I use ClampForever or animation.sample. Then there's a delay when swapping, and when I move it doesn't animate at all. Also, it never swaps the items. The code is long and intimidating, so I'm just asking if there's a way to see if the animation is on the last frame and not when the animation has stopped playing?
     
    Last edited: May 23, 2014
  2. Epictickle

    Epictickle

    Joined:
    Aug 12, 2012
    Posts:
    431
    DezBoyle likes this.
  3. ScottyRich

    ScottyRich

    Joined:
    Oct 7, 2013
    Posts:
    35
    When I set it to default, it jumps to the first frame when the animation's finished.
     
  4. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    you've probably done this already, but check you've imported the animation correctly. Might have pulled in a frame too many? 60 frames is 0 to 59 etc. easy to slip up on... not that i would... often... :(
     
  5. ScottyRich

    ScottyRich

    Joined:
    Oct 7, 2013
    Posts:
    35
    Figured out, but I still have a problem. But when I try to play negative speed, or any other animation, it jumps to being finished. (It isn't the code, I tested it). The only animation that works after forward.anim is played is forward.anim. Why does this happen?
     
    Last edited: May 23, 2014