Setting the visibility of UI nodes is confusing and redundant
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
The visibility of UI entities can be controlled in two distinct ways: via the `Style` component's field, and by setting `Visibility` (you could also muck with `ComputedVisibility` but please don't).
This is both confusing, and results in inconsistent behavior (see #5360 and the resulting #5361).
## What solution would you like?
Remove the `Display` field of `Style`, and let users set this via the `Visiblity` component instead. In the interface with `taffy`, construct the `taffy::Style` struct information based on the combination of these components.
This is simple, allows for direct querying and is much more consistent with the rest of the engine.
## What alternative(s) have you considered?
1. Use `Display` as the canonical representation. This is confusing, and ties us tightly to CSS's model rather than being modular. It's also very inconsistent with the way visibility is handled elsewhere.
2. Automatically sync these. This has non-zero computational costs and serious complexity (and bug-risk) costs, for no apparent benefit.
## Additional context
Prompted by @mockersf complaining about this in https://github.com/bevyengine/bevy/pull/5361#issuecomment-1187633203 <3
Contributor guide
Assessment
This issue has not been assessed yet.