Why will UIToolkit have a separate animation system?

Hello!

In a couple of threads you have mentioned that UITK will have a keyframe animation system and that it will be separate from the current Unity one.

Knowing how both the animation system works (sort of) and how UITK is designed, this makes some sense.
However as a end user, this seems like it will feel terrible. It seems that it would feel like duplicate systems, having 2 animation windows, and two animation files.

Why not update and expand the current animation system to fit the needs of UIToolkit? Even if there are different UITK specific animation files, allowing them to be edited with the Animation window, and having a semi standard API and workflows seems like it would be far nicer for the end user.
Of course this really would require some rewrites on the animation side of things to make the Animator not require an animator controller and what not.

Hi!

There are a few reasons why we’ve made the uss transitions directly in UI Toolkit as opposed to change the Animation/Timeline workflows.

The biggest hurdle was that the Animation/Timeline systems needed a Unity object as the main driver for the animation. Since UI Toolkit is decoupled from Unity objects, it would have required additional objects to be created, which would add to the complexity of setting up and maintaining animations.

Another hurdle was that UI Toolkit does not have a way to uniquely identify individual elements and this would clash with the current workflows in Animation/Timeline.

The benefits of introducing the uss transitions (and we might go the same route if we add uss animations) is that we can define those directly in the StyleSheet assets and they will not break the cascading nature of UI Toolkit (i.e. based on the classes present on an element, your transitions might be overridden with a different, more specific transition). They are also applied as rules, which might target multiples elements.

The way we’ve done it will not prevent us from integrating into those workflows in the future and we have been discussing with other teams about what we will need and how we can get there. For example, it would be very powerful to be able to add/remove classes through a Timeline clip, which would allow to keep the rule-based cascading system we have.

3 Likes