Why should 3D GUI be managed using a manager rather than being a mesh with special attributes?

Why does 3D GUI not fall under special textures or meshes? According to my understanding, 3D GUI should be considered a special type of mesh. What are the benefits of managing 3D GUI with a separate manager? (I only know that currently it cannot be serialized, is difficult to manage, cannot be debugged using the inspector, etc.)

cc @RaananW

Kynect @AutoBikeMan ,

A separate manager can handle specific GUI functionalities like handling user input (clicks, hovers), managing element states (active, inactive), and integrating with game logic or UI frameworks.

These are all valid questions.
The 3D GUI library is part of the GUI library and was meant to work as the counterpart of the 2D GUI with similar (or same) API. It uses a utility scene to render the elements, which is the reason you can’t see it in the inspector (as it is scene-bound), unless you link it to a transform node on the parent scene (like in this example - Babylon.js Playground (babylonjs.com)).

But you are right - it cannot be easily serialized. The utility layer’s scene can be serialized using this code:

const gui3d = BABYLON.SceneSerializer.Serialize(manager.utilityLayer.utilityLayerScene);

but it is not correctly parsed - you get the meshes, but not the gui manager, nor the picking settings. This is something we can tackle in a future version of babylon, if this is asked by the community.