Search Unity

Bug? Possible conflict between RigBuilder and sequences

Discussion in 'Film, TV, Animation & Cinematics' started by akent99, Jun 30, 2021.

  1. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    136
    Reporting in case a problem with sequences beta - not sure. I use "RigBuilder" from Animation Rigging 1.0.3 (Unity package to allow you to do overrides in a timeline, https://docs.unity3d.com/Packages/com.unity.animation.rigging@0.2/manual/index.html). But as I flip around my scene with sequences, I am seeing the error below in the log. I am wondering if jumping between timelines is getting it confused

    upload_2021-6-30_1-14-31.png

    The stack trace is

    MissingReferenceException: The object of type 'RigBuilder' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Animations.Rigging.RigBuilder.StopPreview () (at Library/PackageCache/com.unity.animation.rigging@1.0.3/Runtime/AnimationRig/RigBuilder.cs:157)
    UnityEditor.Timeline.WindowState.OnStopPreview () (at Library/PackageCache/com.unity.timeline@1.5.2/Editor/State/WindowState.cs:994)
    UnityEditor.Timeline.WindowState.set_previewMode (System.Boolean value) (at Library/PackageCache/com.unity.timeline@1.5.2/Editor/State/WindowState.cs:253)
    UnityEditor.Timeline.WindowState.Reset () (at Library/PackageCache/com.unity.timeline@1.5.2/Editor/State/WindowState.cs:440)
    UnityEditor.Timeline.TimelineWindow.OnBeforeSequenceChange () (at Library/PackageCache/com.unity.timeline@1.5.2/Editor/Window/TimelineWindow_ActiveTimeline.cs:52)
    UnityEditor.Timeline.WindowState.SetCurrentSequence (UnityEngine.Timeline.TimelineAsset timelineAsset, UnityEngine.Playables.PlayableDirector director, UnityEngine.Timeline.TimelineClip hostClip) (at Library/PackageCache/com.unity.timeline@1.5.2/Editor/State/WindowState.cs:377)
    UnityEditor.Timeline.TimelineWindow.SetCurrentTimeline (UnityEngine.Timeline.TimelineAsset seq, UnityEngine.Playables.PlayableDirector instanceOfDirector, UnityEngine.Timeline.TimelineClip hostClip, System.Boolean force) (at Library/PackageCache/com.unity.timeline@1.5.2/Editor/Window/TimelineWindow_ActiveTimeline.cs:43)
    UnityEditor.Timeline.TimelineWindow.SetCurrentTimeline (UnityEngine.Playables.PlayableDirector director, UnityEngine.Timeline.TimelineClip hostClip) (at Library/PackageCache/com.unity.timeline@1.5.2/Editor/Window/TimelineWindow_ActiveTimeline.cs:29)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    UnityEditor.Sequences.TimelineUtility.PushItemIntoBreadcrumb (UnityEngine.Playables.PlayableDirector director, UnityEngine.Timeline.TimelineClip hostClip) (at Packages/com.unity.sequences@1.0.0-pre.6/Editor/Utilities/TimelineUtility.cs:111)
    UnityEditor.Sequences.TimelineUtility.RefreshBreadcrumb (UnityEditor.Sequences.TimelineUtility+TimelinePath path) (at Packages/com.unity.sequences@1.0.0-pre.6/Editor/Utilities/TimelineUtility.cs:133)
    UnityEditor.Sequences.SelectionUtility.TrySetTimelineInContextOf (UnityEngine.Playables.PlayableDirector director) (at Packages/com.unity.sequences@1.0.0-pre.6/Editor/Utilities/SelectionUtility.cs:137)
    UnityEditor.Sequences.SelectionUtility.OnEditorSelectionChanged () (at Packages/com.unity.sequences@1.0.0-pre.6/Editor/Utilities/SelectionUtility.cs:83)
    UnityEditor.Selection.Internal_CallSelectionChanged () (at <9540aba417024bb296674f70fa788b73>:0)

    The section of code appears to be:

    void OnStopPreview()
    {
    if (m_PreviewedComponents != null)
    {
    foreach (var previewComponent in m_PreviewedComponents)
    {
    if (previewComponent != null)
    {
    previewComponent.StopPreview();
    }
    }
    m_PreviewedComponents = null;
    }

    It appears the RigBuilder instance has been destroyed, but it is still in the previewComponent list.

    I don't have precise instructions to repeat sorry - the following is to the best of my memory. I have a character with the RigBuilder script in the scene (the only character so far) and dropped a walk animation clip onto it. Hmmm, to be precise, I added "Bear" (character's name) into the scene first using Sequence Assembly, then deleted the Sequence Asset Track from the timeline and added my own Animation Track so I could drop the animation clips directly into it (rather than creating a variant per animation). But then I realized I needed to use "Bear carrying Bag" (a variant of Bear). I used Sequence Assembly to pick the variant. This deleted Bear from the scene and added Bear carrying Bag, but that messed up the animation track as Bear was deleted. I was trying to drop the new Bear carrying Bag from the scene into the timeline for that animation track but it was failing. That is when I noticed the error message. So maybe the problem was swapping the character Bear with a variant Bear carrying Bag got things confused as my timeline was still using the old object...???

    upload_2021-6-30_1-23-34.png

    upload_2021-6-30_1-24-7.png

    Notice in the timeline I also have "Bear" as a track under Character but it references "Bear carrying Bag" - I think that got added back in when I swapped the character from "Bear" to the variant "Bear carrying Bag".

    upload_2021-6-30_1-25-40.png

    But I cannot now delete the "Bear" track above (I pick "Delete" from right clicking, but it does not delete and I get the error in the Console) and I cannot drop "Bear-v11-2 Prefab Variant" under "Bear carrying Bag" in the scene into the first track under "Character" (where it says "None (Animator)") - again nothing happens (except error is added to the log).

    I will restart Unity and try again later - capturing details while I can.
     
  2. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    136
    Oh, I tried one last thing - exiting and restarting Unity cleared the problem. I was able to delete the Sequence Asset Track and drop the character back into the animation track after restart.
     
  3. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    136
    I started talking about options on another thread, then went a bit further and got exactly the game object tree for a character to work in a plain Timeline with Animation Rigging working but fail in a Timeline inside a Sequences package. I included a few more stack traces https://forum.unity.com/threads/ways-to-animate-picking-up-an-object.1165652/#post-7492862 (should have put them on this thread sorry).

    So basically, Animation Rigging looks great, but I get Console stack traces and it does not work when used with the Sequences package, but a copy/paste does work in another Scene with a simple Timeline without Sequences.
     
  4. thomastt_unity

    thomastt_unity

    Unity Technologies

    Joined:
    Nov 6, 2018
    Posts:
    6
    Hi @akent99,
    Apologies for the lack of response in this thread. I'm going to check this out with the team and come back to you.
     
    akent99 likes this.
  5. thomastt_unity

    thomastt_unity

    Unity Technologies

    Joined:
    Nov 6, 2018
    Posts:
    6
    Hey @akent99, I confirm there is a bug when switching a SequenceAsset containing a RigBuilder component to a variant. I filed a ticket on our end to get this fixed. Thank you for reporting this.

    In the meantime, it seems toggling off "Preview" (button at the top-left in Timeline) before doing such operation on a SequenceAsset with a RigBuilder prevents this from happening.
     
    HIBIKI_entertainment and akent99 like this.
  6. ellka

    ellka

    Unity Technologies

    Joined:
    Jun 17, 2019
    Posts:
    28
    Hey @akent99, I spent some time investigating this bug a few days ago and realized it was not necessarily a Sequences problem (at least the source of the problem is not in Sequences itself). And so, I went ahead and open a more general bug here so it can be triage more properly and it also means it's a public issue now that you can follow if you want to.

    Side note: It's not visible for the public, but this forum post thread is linked to this bug internally, so it's already clear it comes from you and it's also clear how Sequences increase the appearance of this bug. I'm mostly saying that so that you know you don't necessarily have to "vote on the issue".

    Thanks for your patience as always!
     
    akent99 likes this.
unityunity