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.
  2. Dismiss Notice

HierarchyTraversal takes almost 1 second in Editor 2021.2.0b7

Discussion in 'UI Toolkit' started by pawelduda, Aug 16, 2021.

  1. pawelduda

    pawelduda

    Joined:
    Feb 1, 2019
    Posts:
    45
    While cursor enters on leaves visual element, there is a HierarchyTraversal call. In Editor it takes almost one second to complete, being really annoying. Yet, there is no problem in standalone.

    upload_2021-8-16_18-36-47.png
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    733
    Hi,
    Your screenshot seems to be taken in deep profile mode, which tends to inflate the measured timings.

    Using the same repro steps and looking at the same frame without deep profiling, are you also seeing 1 sec spent in "PanelLayout.ScalablePanelSettings > Update Style" in the profiler ?
     
  3. pawelduda

    pawelduda

    Joined:
    Feb 1, 2019
    Posts:
    45
    Hi,

    Without deep profile it only shows 60ms. But still, this is huge number and really annoying.

    upload_2021-8-16_21-7-47.png
     
    Maverick likes this.
  4. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    733
    Moving the cursor should normally not cause this kind of spike but this of course varies a lot on the UI itself.

    Are you using many :hover selectors, or a :hover selector on an element that has many descendants?
    Are you maybe doing hierarchy changes inside MouseEnter/Leave event handlers?
     
  5. pawelduda

    pawelduda

    Joined:
    Feb 1, 2019
    Posts:
    45
    We have :hover selectors all around our gui. Not sure what do you mean by many - there is around 100 elements in total with hover state.

    But spikes occur regardless if an element has any hover state or descendants. Even elements without hover and with only a few descendants are causing this issue. And I double checked - there is no issue in Standalone, only in Editor.

    Only changes in PointerEnter/Leave events we made are some changes to displayStyle = toggling between none and flex. But still, they are infrequent and not on every element. And turning them off changed nothing.
     
  6. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    733
    The best course of action I can recommend right now if you could share a reproduction project.

    I wish I could be more helpful but we won't likely get to reproduce this ourselves before a long while.