Can I make animations snap to a frame?

When I import animations from Maya, I bake all the keys for all objects and save the file to Maya Binary format, but I get lots of problems when I play the animations, f.e if I do animation with replacing technique , like replacing the mouth in one frame when I play the animation in Unity the animation will play some inbetween frame that shows the mouth dislocated. I guess this is because Unity is playing the animation based on time and not on frame, but is there a way to make it Snap to a frame?

In Maya, the way to achieve this is to make all keys Stepped which means no interpolation between frames all transformation remain static until next keyframe is reached. but Unity (at least Unity iPhone) does not recognize this kind of interpolation.

If you want to only sample an animation at times that are snapped to frames, you must manually set the time of the AnimationState of the relevant clip in the Update function. In order to snap to frame x, set the time to x / frameRate. You can get the framerate from the AnimationClip.

@runevision
Could you give some example code? Not sure I’m following, especially if I might want it to be on the same frame on every client in a multiplayer game…