"UpdateUILayouts" triggers when updated UI is disabled or invisible, causing unnecessary processing

UIs continue to trigger UpdateUILayouts in the microprofiler when the updated elements are invisible or when the root ScreenGui is disabled.

References:

Reproduction file: Bug.rbxl - view microprofiler while running - chat commands:

  • reset: Enabled = true, Visible = true
  • disable: Enabled = false, Visible = true
  • invisible: Enabled = true, Visible = false
  • fulldisable: Enabled = false, Visible = false

This is causing a ton of unnecessary processing (~2ms on a very high-end machine) in some of my games due to animated UI content, forcing me to now implement deeply unintuitive workarounds such as deparenting SurfaceGuis at distance and deparenting menu UIs when invisible.

Expected behavior

I expect UpdateUILayouts to not trigger if any ascendant UI objects are disabled or invisible. Would be nice if it only re-processed when Visible or Enabled is set to true again.

Thanks for the report! I filed a ticket in our internal database and we’ll follow up when we have an update for you.

Any updates on this? (I understand it is holidays break right now but it would be nice to have this checked afterwards)

Hey @MetatableIndex we are following up on this. We attempted a fix but encountered some issues. Typically there are competing use-cases involving visibility and layout. Some devs want to accurately query the state of inviz objects (which requires layout processing) while others expect zero overhead for inviz objects.

Ideally we can attempt low overhead of inviz objects and provide updates only when queried, however it takes time for us to ensure that this doesn’t introduce any bugs. Thanks for your patience!

That would be great.

I also recently noticed the internal UI quadtree updates don’t seem to respect the Visible property, which becomes an issue when sliding your finger across the screen. My game creates deep UI hierarchies but will always set Visible to false on the subtrees which shouldn’t need to be processed, but they’re still processed. On an older test mobile device from 2015 the difference really compounds.

I think this is further compounded by touch and controller input being heavily tied to poll rates, creating a load of repeat processing (especially at lower FPS). I can create another bug report thread for that, but the other half of the issue seems to be that invisible subtrees are still processed as in the screenshot above.

Hi @NiceDrift, thanks for submitting this bug report!

If possible, would you be able to share repro placefiles for the 2 issues that you mentioned?

  • Performance issue with invisible GuiObjects increasing UpdateUILayouts time
  • Performance issue with invisible GuiObjects increasing ProcessInput time

If you are able to share the placefiles, that would help us verify that the issues are fixed. Feel free to add a private message to the bug report, or DM me if you would like to keep the file private.

I believe invisible GuiObjects (Visible=false) should not be processed by ProcessInput currently, can you share more info on how you can tell they’re still being processed?

Thanks for your help!

I posted the reproduction for UpdateUILayouts in the original post of this thread, here’s a link. Say ‘invisible’ in chat in that place to replicate the issue. It seems to be fixed now when the root ScreenGui is disabled, but not when the root Frames are invisible.

As for the input related issue, I took a snapshot of my game’s UI and set all the top-level GuiObjects Visible to false and it seems to still process:

I sent you the reproduction file for this in DMs. I’m using a 2016 phone (S7 edge) to test this.

OK thanks for the repro file! I think the ProcessInput performance issue looks like it is similar to this existing issue, so we can track it there: Excessive frame time on mobile when dragging on the screen

Then we can focus on the UpdateUILayouts performance issue in this thread.

@NiceDrift would you be able to share the games that are impacted by UpdateUILayouts performance? I may have a potential fix for this, but I would like to test it on some affected games to confirm that it does improve performance. Thanks!