Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UIElements Bugs from 2018.3 -> 2019.1

Discussion in 'UI Toolkit' started by Rocktavious, May 2, 2019.

  1. Rocktavious

    Rocktavious

    Joined:
    May 10, 2017
    Posts:
    44
    Hello. I've been using UIElements pretty extensively in 2018.3.x but after upgrading to 2019.1 and following the migration guide i'm still seeing a few bugs with certain systems that i will enumerate here.

    • VisualElement.schedule.Execute(() => { Debug.Log("Hello World"); }).StartingIn(1000)

      This no longer works consistently - i'm getting a 1/15 chance it will fire - where as .Every(1000) seems to work every time its scheduled
    • ToolbarToggle does not work properly when instantiated from UXML but works perfectly when instantiated from c# code
    • ToolbarFlexSpacer was removed in favor of a "flex" field on ToolbarSpacer but you cannot set this "flex" field to true from UXML IE
      <ue:ToolbarSpacer flex="true" />
      It would be handy to have this from UXML
    • ToolbarButtons no longer style the same when they are not directly under a Toolbar IE
      Code (csharp):
      1. <ue:Toolbar name="toolbar">
      2. <VisualElement>
      3. <ue:ToolbarButton text="button" />
      4. </VisualElement>
      5. </ue:Toolbar>
      This now styles the ToolbarButton like a normal button because of that VisualElement inbetween. This might be expected but what i'm looking for is button like functionality without the normal button styling - maybe there is a better way to go about this?

    This is all i've found so far in 2019 - i really love the direction UIElements is taking so hopefully these bugs will get ironed out sooner rather then later.
     
  2. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    396
    Hi Rocktavious,
    First let me thank you for providing feedback and bug reports. So often people suffer in silence!

    To ensure the best visibility and make sure that nothing goes through the cracks, the best way to report bugs is going through the "Help -> Report a bug" option in the editor.

    The scheduler bug you encounter was sneaked in 2019.1.f2 and has a fix ready for the next 19.1 version. In the meantime, you can workaround the bug in this way, using the "Until" end condition:
    bool called = false;
    VisualElement.schedule.Execute(() => { Debug.Log("Hello World"); called = true;}).StartingIn(1000).Until(called);

    This is not the best looking code but it will have to do until 2019.1.f3 is released

    Toobar issues:
    1.What doesn't work with the toolbar toggle when used with uxml?
    2. Yep the ToolbarSpacer flex should be available from uxml, this is an oversight.
    3. The toolbar button style issue in you case happens because the inserted VisualElement uses the default flex-direction which is column. Declaring it like this should fix the styling issue you have:
    <VisualElement style="flex-direction:row;">

    Thank for your feedback!
     
    ProFiLeR4100 likes this.