Hi fellow gamedevs :D, i have a question about gui performance. So we have have a lot of different windows and i want to ask what is better to have a lot of gameobjects with different gui windows or to have one gui window which has other windows as templates, performance wise ?
You will probably not see any difference in CPU usage unless having tens of thousands of windows.
However, long before that you might get performance issues on the GPU because of many drawcalls or fillrate (overdraw). Having many game objects with separate GUI scenes makes that hard to optimize. Within a scene, however, you have good control of draw calls (with layers).
There is currently a limit of 64 gui scenes loaded at the same time (although I think we’re making that value configurable). This should in some sense be an indicator to not go overboard and break everything down into many many tiny gui scenes, but as @sicher said, you should probably worry more about draw calls and optimising your gui scenes using layers than the number of gui scenes you have in your game.
Personally I don’t think it’s a bad idea to have for instance several different kinds of popups in a single gui, and disable the root nodes of the ones you are not currently using. You could also decide to put each gui scene in a separate collection, similar to what is done in this recently announced community library, but then you should also keep in mind that when you load a collection proxy you get a new physics world with all that it entails in terms of memory usage.
There’s currently a limit of 64 GUI components per collection, this will be configurable in the next version (currently available on alpha and beta channels)