How can I make my animation values stick after the animation is complete?

I have a button that I’m trying to animate. I have two clips, a TurnOff clip which:

  1. It slides the button to its Off position.
  2. It replaces its sprite to show the Off sprite.

and a TurnOn clip which does the opposite.

I’m using 4 states to manage this:

  1. On, which waits (it has no clip associated clip), and once IsOn is false transitions to TurnOff.
  2. TurnOff, which plays the TurnOff clip, then transitions to Off.
  3. Off, which waits, and once IsOn is true transitions to TurnOn.
  4. TurnOn, whicih plays the TurnOn clip, then transitions to On.

This is what the states look like:

alt text

The problem is, once TurnOff is complete, the button snaps back to its original position (it also does a little bounce when it gets there) and sprite, rather than retaining the values as they were at the end of the animation, which is what I would like (so that the button remains in the Off position with the Off sprite).

Is this the proper way to do something like this? If so, how can I get the values to stick once the animation is complete?

Thank you.

Um, have you tried the new UI.Button class? There are built in state transitions. I realize you probably don’t want to hear “learn a completely different tool”, but learning the built in API really does make a huge difference.

http://unity3d.com/learn/tutorials/modules/beginner/ui/ui-button