Get Animation frame


How can i get the animation frame when an animation is playing, i need it to play a footstep sound. I did not find such function in the Api.


For animation clips I couldn’t find neither how to get current frame of the clip. (I’m also a beginner with this engine)

But you can get what clip is playing now (it may return multiple if you blend animations):

And you can also test if a certain animation clip is playing

For 2D sprites you can get current frame like so.

Not sure if it helps. But from my experience, it is not a good idea to do anything based on what frame is currently playing because if the animation speed and your game is optimised let say for 30FPS but someone is playing the game at 20, there is a chance animations may skip a frame or two (if lot of frames are skipped this is when you experience lag). So in case you play a footstep sound on a specific frame and the frame going to be skipped due to low frame rate, the sound will not going to play. In general it is always best to divide your animations in to groups like Idle, Walk, Jump, Fall and check what animation is playing instead of what frame. In your case, play footstep sound if walking animation clip is playing and loop the sound to fit the animation instead of trying to catch the moment the foot touch the ground.

Hope it helps.


With a timer when an animation start we should be able to check some rounded frames.
This is missing, i used events in Unity.