Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

selecting editor uxml causes error console errors

Discussion in 'UI Toolkit' started by ANFADEV, Dec 11, 2021.

  1. ANFADEV

    ANFADEV

    Joined:
    May 27, 2016
    Posts:
    67
    Hi,
    I'm currently working on an editor tool i made using UI Builder preview 18, in Unity 2019.4
    I exported this tool multiple times as a unitypackage, when i import it in a fresh project in a newer version of Unity (i tested 2020.3, 2021.1.14, 2021.2.3), and try to open the editor window it fails, giving this error:

    And when i select the .uxml file the console has immediately 999+ errors:

    I tried importing the lastest verison of UI builder (com.unity.ui) but the error persists

    The only time it worked is whe i imported it to a fresh project using Unity 2020.1
     
  2. ANFADEV

    ANFADEV

    Joined:
    May 27, 2016
    Posts:
    67
    I found the cause of the problem while trying to make a new uxml file using ui builder in Unity 2020.2.

    It turns out that in the newer version ui builder no longer allows me to add a visual element inside a ListView, and it seems it's for a good reason, i had it setup this way in the older uxml.

    Solution: i just modified the older uxml to use ScrollView instead of ListView, and now it works in all versions

    By the way this is for a UI styling tool for UGUI, i'm planning to release it on the assetstore in the near future:
    just for a peek, this is the comparison between the IMGUI and the UIToolkit implementations

    Old:

    New:


    Pretty different!
     
  3. sebastiend-unity

    sebastiend-unity

    Unity Technologies

    Joined:
    Nov 9, 2015
    Posts:
    182
    Nice stuff! And thank you for writing about your findings. Indeed we now prevent users from adding elements to a ListView (or its contentContainer) directly, for obvious reasons, sorry you had to find out that way. Everything goes through makeItem and bindItem now, making the contentContainer unavailable.
     
    ANFADEV likes this.