Search Issue Tracker
By Design
By Design in 2023.3.X
Votes
0
Found in
2021.3.35f1
2022.3.20f1
2023.2.11f1
2023.3.0b8
Issue ID
UUM-64345
Regression
No
”style.display” on UI Elements stops working when the UI Document (or its parent) is disabled and re-enabled
How to reproduce:
1. Open the attached “display.zip” project
2. Enter “SampleScene” Scene (Assets > Scenes)
3. Enter Play Mode
4. Observe the Game view
5. In the Hierarchy window, select “UIDocument” GameObject
6. In the Inspector window, disable and enable the “UI Document” Component
7. Observe the Game view
Expected result: All elements are visible
Actual result: Some elements disappear
Reproducible with: 2021.3.35f1, 2022.3.20f1, 2023.2.11f1, 2023.3.0b8
Reproduced on: macOS 14.2.1 (Intel)
Not reproducible on: No other environment tested
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
This is a current limitation on how UIDocuments behave when disabled and re-enabled. When doing so, the UIDocument will re-create its UI. This means that VisualElements that are held in private member are basically "stale", and modifying them will not have any impact.
There are many ways to work around this limitation. A simple one is to register a "detached from panel event" to the root element (using root.RegisterCallback<DetachFromPanelEvent>) to know if the UIDocument was disabled. Then, once the root element is not null anymore, you can refresh your private VisualElement members.
Resolution Note (2023.3.X):
This is a current limitation on how UIDocuments behave when disabled and re-enabled. When doing so, the UIDocument will re-create its UI. This means that VisualElements that are held in private member are basically "stale", and modifying them will not have any impact.
There are many ways to work around this limitation. A simple one is to register a "detached from panel event" to the root element (using root.RegisterCallback<DetachFromPanelEvent>) to know if the UIDocument was disabled. Then, once the root element is not null anymore, you can refresh your private VisualElement members.