What is the best way to organize multiple screens/panels where only one is visible at a time in UITK?
Here are the options I know of:
One UI document per panel, disable inactive documents using display property
One UI document per panel, disable containing gameObject
One UI document in total, one root visual element per panel, disable inactive parts by disabling root visual elements
Are there any other options?
The criteria I’m considering are both performance and ease of use/maintainability. I’m still novice in UITK so I don’t even know which workflow would be easiest to work with (and I guess that’s subjective) - but maybe Unity devs can at least explain what their intent is?
The performance aspect comes into play both when switching the active panel (is there a delay? How much?) but also CPU/memory usage of disabled panels.
I’m going for one UIDocument per scene plus several UIDocuments that I use like prefabs to populate my scrollviews. For my needs performance is fine, but I must admit that I haven’t looked very deep in that direction.
For the panels I have 3 main panels in my UI, that I’ve named “top-panel”, “middle-panel” and “bottom-panel”, the middle panel is usually set to visibility hidden, that lets the user select elements on the 3D scene, and it only activates when I display a popup or dialog box. And those popups have display none when inactive.
Anyway, as I said in another thread , I am also still skeptical about using many UIDocuments with “display:none;”. I think “visibility:hidden” would be more costly, because its bounding box etc will be calculated but it just won’t be drawn on the screen. The reason I don’t want to instantiate/destroy pages (I am not talking about headers, footers) is that I just don’t want to hook actions/prepare their inputs/buttons/localized texts/etc every time I need to show them.