Enumerate AnimationEvents

Does anybody know a way to get access to the AnimationEvents for a particular animation from a non-Editor script? I know aboutt AnimationUtility but that’s only good for Editor scripts, it seems.

My use case is that I want to be able to add ‘tags’ to different points on the animation timeline, so that I can start an animation part way through. I figured the events might be a good way to simulate this, since I can use a string function argument as a tag name.

One solution I’m trying is to do it at edit time with an editor script that accesses AnimationUtility.GetAnimationEvents, and then just save the tags it finds as data on the game object being animated.

You could at Start play the animation through (using Sample, not actually by time passing), and in the animation event function, record the parameter and time of the animation.

Okay, far less kludgy idea: have an enum property and increase it by 1 (constant curve) at each tag point. Process the curve to extract the times and associate that back to the enum.