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

Layout update is struggling to process current layout

Discussion in 'UI Toolkit' started by noirb, May 5, 2022.

  1. noirb

    noirb

    Joined:
    Apr 10, 2014
    Posts:
    84
    Code (CSharp):
    1. Layout update is struggling to process current layout (consider simplifying to avoid recursive layout): VisualElement PanelSettings (x:0.00, y:0.00, width:2133.33, height:1200.00) world rect: (x:0.00, y:0.00, width:2133.33, height:1200.00)
    2. UnityEngine.UIElements.UIElementsRuntimeUtilityNative:UpdateRuntimePanels ()
    We often see this error when manipulating UIElements, and it seems to often correspond with visual glitches, but we're not sure what we need to do to avoid it, or how to go about isolating the root cause. Are there any tips for this?

    For example, when scrolling a list of lists of stuff (in which each list is configured for Dynamic Height virtualization), we often see some flickering when the sub-lists get long enough, and in some cases we have seen some list entries occasionally disappearing, or not having their height calculated correctly causing them to get cut off. In all of these cases we see the above error.

    In the gif on the left, you can see some general flickering. On the right, you can see that the bottom-most list is sometimes fully visible and sometimes cut off (seems like its height was mis-calculated so it became impossible to scroll to the bottom of that element).

    GIF 5-5-2022 9-16-27 PM.gif GIF 5-5-2022 9-35-30 PM.gif
     
    Last edited: May 5, 2022
  2. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    247
    Hi, we are aware of an issue with scroll view invalidating layout too often when the scrollbar is visible, which causes what you are seeing with the dynamic height list view. We are currently working on a fix. Stay tuned!
     
    jeremiespoken and ameyer_unity like this.
  3. noirb

    noirb

    Joined:
    Apr 10, 2014
    Posts:
    84
    Great to hear, thanks!
     
  4. ameyer_unity

    ameyer_unity

    Joined:
    Mar 3, 2020
    Posts:
    1
    I've been getting this error as well when I use VFX graph and dock the window next to the inspector in default layout. I noticed the error when Unity's log file filled up my hard drive when I left Unity running for a few hours. You're probably aware that it spams the log file repeatedly, causing issues with the computer in general and not just Unity. Is there a setting to prevent this from happening? I'm happy to hear that the scroll view issue will be fixed, though.
     
  5. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
  6. alexandred_unity

    alexandred_unity

    Unity Technologies

    Joined:
    Dec 12, 2018
    Posts:
    43
    Hi,
    the fix landed in 2023.1 and it is being backported to 2022.2
     
    mikejm_ likes this.
  7. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    Is it already backported?
     
  8. Lgd-studio

    Lgd-studio

    Joined:
    Oct 31, 2016
    Posts:
    4
    Hello, in 2022.2.f2 the problem is still present. we can not work in this way, please solve the problem as soon as possible
     
  9. Lgd-studio

    Lgd-studio

    Joined:
    Oct 31, 2016
    Posts:
    4
    Follow error on console

    Layout update is struggling to process current layout (consider simplifying to avoid recursive layout): VisualElement unity-panel-container (x:0.00, y:0.00, width:348.67, height:959.33) world rect: (x:0.00, y:0.00, width:348.67, height:959.33)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
     
  10. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,383
    Getting a similar issue. Any fix?
     
  11. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    771
    Investigating.
     
  12. Deleted User

    Deleted User

    Guest

    Hey there, thank you for being on top of this @antoine-unity . I think what's most important about this issue is implementing a comprehensible error message that tells us where the error is coming from. I'm experiencing the same problem and can somewhat narrow it down to the general part of the UI where it's coming from but without more info it's near impossible to find the problem and fix it.
     
  13. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    771
    It's pretty hard to give an exact cause from an error message. Instead the approach we're taking is a debug window to help identify the culprit element visually.
     
  14. ImmanuelScholz

    ImmanuelScholz

    Joined:
    Aug 10, 2017
    Posts:
    4
    Actually, I think the most important thing here is to implement an sane non-spamming error logging system.

    It is NEVER a good idea to fill up any log with the same message over and over again. That is not only true for this problem here, but also for the many other errors that constantly spam unity logs, making it very hard to use.

    I am regularly switching between Unreal and Unity projects and have to say, this is very seldom an issue with unreal engine (due to their _default_ setting of reporting ensure's only once) compared to unity, where I constantly have spamming errors for issue like this here, native list allocations, burst compile issues etc.. making it a pain to work with the unity editor when one of these errors happen again.

    Also, there is no built-in way (I know of?) in Unity to just shut up certain error messages (even if they are not spamming), again: making it unnecessarily hard to work with the console and errors in general.


    Btw.. There are more disadvantages of uncontrollably spamming logs. In my Unreal project, my co-worker (who do not switch engines) are usually more aware of looking at error messages, including the "first error" (which is most of the time the culprit). This leads in general to fewer "accepted errors" queuing up. In Unity, due to its overall log spamminess, people are more like "meh... idk.. its probably nothing. If it would be important, Unity will tell me probably again." The "first error" seldomly gets looked at, when there are thousands upon thousands other log entries below...
     
  15. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    771
    I just wanted to make sure you are aware of the "Collapse" option in the Console. It doesn't always work properly if there are minor differences in the contents of the message but I believe it would work for a repeating "Layout update is struggling..." scenario.

    To expand on my previous message, we are working on a dedicated tool to troubleshoot layouts that fail to converge. We could reconsider how this situation is being surfaced to you and improve over the basic console spamming.

    I think it would be best to share your feedback about console spamming in Unity in general under this subforum:
    https://forum.unity.com/forums/editor-general-support.10/
     
  16. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    I don't know why it was, but under previous versions of Unity it used to spam this message endlessly and sporadically once my layouts reached a certain level of complexity (sometimes the same layout would spam it, other times it would not).

    For whatever it is worth, I am not getting this message anymore. I do not think it is due to anything I did specifically. My layouts are only more complex by the day.

    So if anything changed, thanks for the fix. It was endlessly frustrating before.

    You will definitely get this message in a deserving fashion if you set something to resize based on something, which then creates a circular resizing loop. Like via RegisterCallback<GeometryChangedEvent>. So be careful of that.

    If it is a legitimate problem, the only way I have found to narrow it down if you're not sure where it's coming from (if it is a true issue and not just the random/sporadic complex panel spamming issue from before) is to just disable things systematically until it stops.