Unity 6 upgrade guide?

Is there a central place that collects information on how to update UIToolkit code to Unity 6?

There are a lot of obsolete warnings about uxmltraits, PreventDefault, ExecuteDefaultActionAtTarget etc.

I’m just starting to dig around to see how to fix each of these, but it would be great if the information was in one place.

Examples of how to conditionally compile for pre-Unity 6 and Unity 6 would also be helpful.

unity 6 is not out yet… so… not really the beta is out

I am guessing you were using a version before 2023.2. The UXML Trait System was marked obsolete for the much better UXML Object System starting in 2023.2.

Below is a link to the fully updated Unity 6 documentation which is already heavily finished and easy to follow now.
They have examples for custom UI Controls, using the improved binding system, the new UXML Attribute system to extend on top of the UI Toolkit features, and a lot more.

Basically they have about 30 or 40 pages no joke of documentation for the UI Toolkit in Unity 6. There are example GitHub projects by Unity to also give actual project examples of the newly updated code. So thankfully they have a lot of resources ready for the community.

https://docs.unity3d.com/6000.0/Documentation/Manual/UIE-custom-controls.html

2 Likes

Yeah, I’ve got a pretty big code base developed in 2022.3 that has a lot of obsolete warnings in Unity 6.
I’ve figured out the new attribute system from the docs (much nicer than the old way), but was still hoping for some kind of upgrade guide. For example, it’s not immediately obvious what you’re supposed to replace ExecuteDefaultActionAtTarget methods with.

A lot of people have already developed a lot of code the old way, so some kind of upgrade guide similar to the the migration guides would be helpful.

1 Like

I think I saw documentation about those changes somewhere in the UI Event Callback documents.
They simplified a lot of the call sequence for UI Events. Example read the event handling sequence on the two pages below. First thing at the top notice on the old page how the sequence was five steps where now it only is handled in two steps. During the old five steps it mentions things like ExecuteDefaultActionAtTarget.

Unity 6 version
https://docs.unity3d.com/6000.0/Documentation/Manual/UIE-Events-Handling.html

Unity 2022.3 Version

1 Like