Search Unity

Bug Parent Constraint losing sources when animating via timeline and turning into prefab

Discussion in 'Animation' started by LeFx_Tom, May 12, 2022.

  1. LeFx_Tom

    LeFx_Tom

    Joined:
    Jan 18, 2013
    Posts:
    88
    We have seemed to encountered a bug when combining parent constraints with timeline animations.

    To reproduce:

    Create and animate an object (like a robot arm for example)
    Create an object, it should carry and add a Parent constraint to it.
    Add all necessary sources to the constraint (so for example starting table, robot-arm, end-position-table)
    Create a timeline
    Create an animation track and animate the the constraint weights, so the object gets parented/attached and detached at the right moments in time.

    Press play/play timeline to validate it works
    OPTIONAL: Turn recorded clip to clip asset (doesn't matter - just for the sake of trying it)

    Turn whole thing into a prefab

    Close Unity/open new scene
    Drag Prefab into scene

    Check: Sources in constraint are still there, list is full
    Press play/play timeline --> BUG: Sources are suddenly empy, but the weights still animate correctly.


    ----

    I believe this is a bug and it is a hell of an annoying one, because it prevents the use of these two components on prefabs as is.


    I found a workaround:

    Convert the animation clip to a clip-asset, open it to for edit in the animation window, delete every animated property, that is not a keyframed weight-change. It will still work, because the sources are still correctly set within the constraint, it will work as intended. The "record" function simply records things it cannot use later and breaks things by that.