Search Unity

Animating scripted values

Discussion in 'Editor & General Support' started by sibhod, Jun 6, 2012.

  1. sibhod

    sibhod

    Joined:
    Apr 13, 2009
    Posts:
    20
    I'm having some issues with animating custom values I've created.

    For example, I created a variable for my character's blink animation: 0 being open, and 1 being fully closed. The script runs in the editor, and sets properties of a handful of child objects to accomplish the blink.

    My goal is to be able to animate just the blink value in the Animation window, in tandem with other character animations. My problem I've discovered is when the Animation window is in record mode and I'm modifying properties, it not only records the value I changed, but any value my script changes also.

    The result is a ton of junk keyframes being splattered all over the animated child objects, which in turn completely ruins the animation's final result. I can fix the issue by manually deleting the curves on every single child property, but the next time I change the blink value, I have to clean up all the children again.

    Is there a way to set values of a child object without causing the Animation window so set a keyframe, or is there just a better way to accomplish this? It's pretty crucial in some situations to have a script set a property, like 2dToolkit sprites that scale and color values which don't animate without a scripted setter.

    Thanks!