One of the features that I'm really surprised is missing is the ability to manually create a keyframe using a button or hotkey, or even a simple method that adds a keyframe to a track. Currently the only way to add a keyframe to a recorded gameobject is to hit the 'Record' button then move it in the scene view. Moving it via script doesn't even trigger a keyframe in Record mode. Does anyone know any way to add keyframe to an Animation Clip on the Timeline manually?
Hi @ajsmith22 There is actually a way to do it, when in record mode, right click on the property you want to record through the inspector window.
Nice, that is somewhat helpful! Is that method accessible through script to make a hotkey out of it, or call it from another function by any chance? Also, is there a way to toggle Record Mode for a track via script ?
No, the recording isn't available via script, and there are no hotkeys yet for adding a key. What you could do via script is create an animation clip using the AnimationUtility class and add it to an animation track.
That does help somewhat! I had tried using imported clips before and it wouldn't let me record over them, but something I'm able to do is "Convert To Clip Track" once I've recorded on a track, and then from there I'm able to access the clip, as well as record onto it.
Sorry for reviving such an old topic, but just wanted to know if the "Add Key" functionality still isn't available through scripts? I've been making a custom transform inspector with some added functionality, which works great for the most parts, but is struggling when it comes to animating transform paramters in timelines, because if the reasons explained above. It'd be great if I could have the "Add Key" functionality available through scripts, so I could call it when needed.
A change just landed (targeting 2019.1) that exposes all the animation clips used by timeline (animation clips, tracks, playable clips and tracks). Exposure to the animation clips lets you modify them as you see fit (add key, add curve, etc...). Unfortunately it's not a back-portable change, so it's not really available in 2018.3, although there are workarounds using SerializedProperty (e.g. TrackAsset.m_AnimClip is the animation clip for infinite tracks).
Hi seant I just asked a question about adding keys to custom clips over here https://forum.unity.com/threads/add-key-via-c-script-in-custom-clip.597142/ Does what you are saying above mean that I can't add keys to custom clips in 2018.2.x? Thanks
No, custom curves are exposed. I answered the question there. What you are doing should work just fine. Custom curves don't have the same limitations as recorded animations on animation tracks.