Animation Time?

I animated a character and I’m ready to import it into Unity. However, Unity runs animations in units of frames, and I need animations to play and loop in units of TIME. Is it possible to set, for example, 20 frames of animation to be equivalent to one second? If so, how? I’m new to Unity, so I would appreciate it if any help were n00b-friendly. Thanks!

Unity runs animations in either seconds or a 0-1 percent. Look up AnimationState: length and (current)time are in seconds. normalizedTime is the percent. The animation docs make a point of saying the (key)frames are turned into a continuous time curve, and then the actual frames are sort of ignored.

Now, on import, Unity “guesses” the animation length based on the framerate you were using. It might assume your 20-frame animation should take 2/3 sec. But (as ETS wrote,) you can easily change playback speed to 0.6666, to take 1 sec. Turns out length is locked at the starting guess, so you can’t just change it to 1 sec.

For fun, say an animation plays over 3 seconds (doesn’t matter how many frames it was, as long as you adjust speed.) If you want to jump to the 2 second mark, which is 2/3’s of the way, use the percent method: animation["A"].normalizedTime=2.0/3.0;. No frames needed.

[Note to self: hit refresh before starting a response]

I’m not entirely sure what you mean by “Unity runs animations in units of frames”. Unity actually iterates animation time in seconds, i.e. AnimationState.time is in seconds. For imported models frames-per-second number comes from the file, so look for that setting in your animation tool.