Create custom animation via C# script at runtime?
Seems like the simplest thing: how do I create a custom animation via C# script at runtime?
That is, I want to compute the keyframe values I want in my script, and set them at runtime.
I've looked at lots of docs and posts, but am still lost.
How do I even access an AnimationCurve at runtime? Ideally I'd just create empty curves in the editor, then set the keys at runtime. Or do I have to create whole new AnimationCurves? There's AnimationClip.SetCurve(), but the docs say this only works in legacy animations. Why?!
I just want to say "Here are the keyframes, now trigger the animation".
It looks like most of the useful API calls for creating and editing animations via script are now obsolete, eg AnimationUtility.GetAllCurves() and AnimationClip.SetCurve().
The newer Animator component seems far more limited in this way than the legacy Animation component. Why did they change this?