Hi, I'm basically trying to do exactly this: https://forum.unity.com/threads/animate-custom-type-property.589663/#post-3936382 But there are no answers. To summarize, I have a custom component, and it has a SerializeField pointing to a custom ScriptableObject. Here's my code: Code (CSharp): var anim = AssetDatabase.LoadAssetAtPath<AnimationClip>( "Assets/MyAnimationClip.anim"); var binding = EditorCurveBinding.PPtrCurve("", typeof(MyComponent), "_myField"); var keyframe = AssetDatabase.LoadAssetAtPath<MyScriptableObject>( "MyScriptableObjectAsset.asset"); var array = new[] { new ObjectReferenceKeyframe { time = 0, value = keyframe }, new ObjectReferenceKeyframe { time = 10/60f, value = null }, new ObjectReferenceKeyframe { time = 20/60f, value = keyframe }, new ObjectReferenceKeyframe { time = 30/60f, value = null } }; AnimationUtility.SetObjectReferenceCurve(anim, binding, array); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); The result is that I can see the keyframes in the editor, but more often than not it says the component is "missing" (it's not), and no matter what it will never change the given property. Are sprites somehow hardcoded in the engine or something? I knew the Animation editor window was limited in what it could do, but this is really disappointing. Alternatively to this, is there a way to set an ObjectReferenceCurve onto a custom PlayableAsset?
Another unanswered question: https://answers.unity.com/questions/595877/object-reference-keyframe-.html It's seeming like the answer is "it's just not possible," but I guess my question then is, "why??" Nothing in the API suggests that this shouldn't be possible. Is there something special about how SpriteRenderer is implemented, or about Sprites?
Weird, I've never used EditorCurveBinding.PPtrCurve(...) before. For example, I've only used something like this, regardless of whether or not the curve was an objectReference or not: Code (CSharp): new EditorCurveBinding() { path = "Your/Transform/Path", propertyName = "m_Sprite", type = typeof(SpriteRenderer) }; I think this should work, but let me know if it doesn't.