Correcting missing component references in animation clips?

(Also posted at http://answers.unity3d.com/questions/1083728/correcting-missing-component-references-in-animati.html)

Not sure if this should be in Editor or Scripting…

I’ve been refactoring some code in a project. I have quickly learned this is a horrible idea as component references are lost all over the place… (Especially if you’re moving from .dll to source, even if the same classes/namespaces are present)

Missing components on game objects can easily be corrected by selecting the class manually.

However, with animation clips I can’t seem to find a way to repair a component reference.

I know how to rename properties/paths in clips via code, but can’t seem to find a way to change the component it refers to.

I notice that AnimationClip.SetCurve has a Type argument, but this presumes I have all the keyframes. It seems that any serialized keyframes aren’t returned from AnimationUtility.GetEditorCurve when the component reference is gone…

Is it possible to correct this without loss of data?

2343702--158560--Capture.PNG

1 Like

I have similar problem. I am generating Animation Clips and it seems that SetCurve can’t find a component.