loop transition

I have the same errors UIToolkit StyleAnimation issue transition property references non-set value when exiting play mode with active transition animation in the Unity editor. My UI is a tooltip, and I wanted to make a pulse animation in a loop (just change scale). Is it a bug or it must be done in a different way?

Unity version: 2022.2.0b4

uss

.animation-blink {
    transition-duration: 0.6s;
    transition-property: scale;
    transition-timing-function: ease-in-sine;
    scale: 1.05 1.05;
}
private const string _animationBlink = "animation-blink";

Awake

_tooltip.RegisterCallback<TransitionEndEvent>(e => Animation());
    private IEnumerator Start()
    {
        yield return null;
        Animation();
    }
private void Animation()
    {
        _tooltip.ToggleInClassList(_animationBlink);
    }

I have tried using Coroutine, UnregisterCallback in OnDisable and other things. Nothing help.

I found a solution by simply reordering UIDocuments in the scene: UITooltip is with a looping transition and no errors if it is above other UIDocuments.

Unity 2022.2.0b10 or sort order in the Inspector - still the same errors. The only solution is what I described above.

I also show you all errors:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UIElements.VisualElement.get_nextParentWithEventCallback () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.UpdateCallbackParentCategories () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.get_eventCallbackParentCategories () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.HasParentEventCallbacksOrDefaultActions (UnityEngine.UIElements.EventCategory eventCategory) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+Values`1[T].SendTransitionCancelEvent (UnityEngine.UIElements.VisualElement ve, System.Int32 runningIndex, System.Int64 panelElapsedMs) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+Values`1[T].CancelAllAnimations (UnityEngine.UIElements.VisualElement ve) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem.CancelAllAnimations (UnityEngine.UIElements.VisualElement owner) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.UnityEngine.UIElements.IStylePropertyAnimations.CancelAllAnimations () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.UnregisterRunningAnimations () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.WillChangePanel (UnityEngine.UIElements.BaseVisualElementPanel destinationPanel) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.SetPanel (UnityEngine.UIElements.BaseVisualElementPanel p) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement+Hierarchy.SetParent (UnityEngine.UIElements.VisualElement value) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement+Hierarchy.RemoveAt (System.Int32 index) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement+Hierarchy.Remove (UnityEngine.UIElements.VisualElement child) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.RemoveFromHierarchy () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.UIDocumentList.RemoveFromListAndFromVisualTree (UnityEngine.UIElements.UIDocument uiDocument) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.PanelSettings.DetachUIDocument (UnityEngine.UIElements.UIDocument uiDocument) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.UIDocument.RemoveFromHierarchy () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.UIDocument.OnDisable () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UIElements.VisualElement.get_nextParentWithEventCallback () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.UpdateCallbackParentCategories () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.get_eventCallbackParentCategories () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElement.HasParentEventCallbacksOrDefaultActions (UnityEngine.UIElements.EventCategory eventCategory) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+Values`1[T].QueueTransitionEndEvent (UnityEngine.UIElements.VisualElement ve, System.Int32 runningIndex) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+Values`1[T].UpdateProgress (System.Int64 currentTimeMs) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+Values`1[T].Update (System.Int64 currentTimeMs) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElementAnimationSystem.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.Panel.UpdateAnimations () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.BaseVisualElementPanel.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.RuntimePanel.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.UIElementsRuntimeUtility.UpdateRuntimePanels () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.UIElementsRuntimeUtilityNative.UpdateRuntimePanels () (at <c9c6a76099e240a893d3af0dc16ae863>:0)

the last one spammed the entire console until you clicked play mode again

ArgumentException: An item with the same key has already been added. Key: UnityEngine.UIElements.StylePropertyAnimationSystem+ElementPropertyPair
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <7ab397abd13b41e3ad74fc63bc0bd4a1>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <7ab397abd13b41e3ad74fc63bc0bd4a1>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+AnimationDataSet`2[TTimingData,TStyleData].Add (UnityEngine.UIElements.VisualElement owner, UnityEngine.UIElements.StyleSheets.StylePropertyId prop, TTimingData timingData, TStyleData styleData) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+Values`1[T].UpdateProgress (System.Int64 currentTimeMs) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem+Values`1[T].Update (System.Int64 currentTimeMs) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.StylePropertyAnimationSystem.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualElementAnimationSystem.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.Panel.UpdateAnimations () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.BaseVisualElementPanel.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.RuntimePanel.Update () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.UIElementsRuntimeUtility.UpdateRuntimePanels () (at <c9c6a76099e240a893d3af0dc16ae863>:0)
UnityEngine.UIElements.UIElementsRuntimeUtilityNative.UpdateRuntimePanels () (at <c9c6a76099e240a893d3af0dc16ae863>:0)

8519630--1136090--uitoolkit_transition_fix.png

Just found Unity - Manual: Create looping transitions but the issue still exists in play mode.

As I mentioned, if a UIDocument with a transition loop is under another UIDocument on the scene hierarchy and the transition started in play mode then exits play mode, the errors will spam the entire console.

I can’t make a transition in another UIDocument, only one and it has to be at the top.

Any comment, fix coming?