Hi all -
I’ve reported this to Unity as a bug, but I thought I’d see if anyone had any ideas for a workaround.
- What happened
I have a VisualElement container which holds a set of controls for a simulation. There are two sets. When the “Horizon” checkbox is clicked the VisualElement containing the “altitude and azimuth” controls should have DisplayStyle.Flex set and the VisualElement containing the “right ascension and declination” controls should have DisplayStyle.None set. The opposite is true when the “Equatorial” checkbox is checked. Instead, even though the DisplayStyle.None is being properly set, the VisualElement is still visible on the screen. If the UI Toolkit debugger is running, selecting any UI Element in the left hand box forces a screen redraw and the components display (or don’t display, as required) properly.
- How can we reproduce it using the example you attached
Screenshot 1 shows the UI Toolkit debugger running. Horizon is checked, and the altitude and azimuth controls are showing. Screenshot 2 shows what happens when the Equatorial checkbox is checked. As you can see, the right ascension and declination controls are in the foreground, but the altitude and azimuth controls are still visible behind them. Clicking on any UI element in the debugger forces a screen redraw and the altitude and azimuth controls are now no longer drawing (which is how it should be). Screenshot 3 shows this state. Doing the same thing with other UI elements in this same project functions properly. I’m unsure why only these elements are misbehaving, but the fact that the debugger works whenever a screen refresh is forced seems to indicate that it’s a bug somewhere. Any advice would be appreciated!
In addition, whenever I move the scrollbar VisualElement, I’m seeing “tearing” or artifacts. You can see those in the last screenshot. This may be related to the screen not refreshing described above, but again, if anyone has any ideas for a workaround, I’d appreciate it. Is there a way to force a screen refresh with UI Toolkit? MarkDirtyRepaint didn’t seem to have any effect.
Thanks!
Kilo



