Search Unity

Question Recovering keyframes after reorganizing hierarchy

Discussion in 'Animation' started by Lo-renzo, Nov 27, 2020.

  1. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,511
    prob - Copy.png
    Here I have an animation that uses transform-based keyframe animation. However, I want to reorganize my hierarchy. This unfortunately breaks these animations, so I am wondering if there's any way to rebind the animations given a new hierarchy.

    Old hierarchy
    Code (CSharp):
    1. Parent (animator lives here)
    2.    Body
    3.       Head
    New hierarchy
    Code (CSharp):
    1. Parent (animator lives here)
    2.    Pivot
    3.       Body
    4.          Head

    Because I'm inserting a gameobject named "Pivot" between "Parent" and "Body" this breaks all animations that targeted the Body / Head.

    Is there a way to fix animations based on the old hierarchy? Or is the only way to proceed to redo them? If I must redo them is there a way to copy paste as much as possible?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  3. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,511
    This is interesting, trying the lite version. Question: is it the case that the intended workflow I need to create an Animation Controller that uses the clip in order to preview it / edit the clip (its transform keyframes)? I want to Play it from a script, having no controller ultimately. But am I right that the only way to preview it is with a dummy Animation Controller that I then should clear when it's no longer needed for previewing/editing purposes?
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Transitions have their own Preview window.

    Or if you have a script that references your animation attached to any of the parents or children of the object with the Animator and AnimancerComponent, then Unity's regular Animation window should pick up that animation automatically.
     
    Lo-renzo likes this.
  5. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,511
    Aha, it seems that I needed a script with the clip referenced in it. Thanks.