Moving Player only during part of an animation

I have a looping animation that is 45 frames long (1.5 seconds), when it plays I want to translate a game object a set distance over time, but it should be moving only during frames 15-45 (so 1 second). So .5 seconds into the animation at frame 15 i want the object to move a set distance over 1 second. I will use vector3.lerp() for the movement:

transform.position = Vector3.Lerp(startPosition, endPosition, speed * Time.deltaTime);

But how can I get this command to execute at frame 15 of the animation?


You can use animation events to achieve this functionality. This will show you how you to use events:

Events tutorial starts at time “2:40” in this video.