Scene or manual grouping design question

In my game there are lots of UI components, static sprite groups etc. So I’m a bit confused about which design I should follow:

  1. Should I create a Scene for each component and group and launch them on parallel in my main screen?

  2. Or should I create a GameObjects.Group for each component and manually hide and show (maybe create and destroy) them?

Which do you think is more suitable and maintainable for a game with a complex UI structure? Actually I don’t care about performance much because my game is mostly static (like a grand strategy game), there are not lots of animations, game objects etc.

I would maybe try a Layer game object.

Great, I didn’t know about Layer. I think that’s what I need instead of Group. I think a mix of a few screens and Layer objects will do the work for me!

Hi,

I would suggest using scenes. But it really depends on the game and the complexity of the UI components. Maybe it’s overkill.

I’m working on a game where there is mostly one scene, like the main one where the game happens, and many UI scenes according to actions on the main one.
So, there is almost likely always a consistent running overlay scene with data that handles and shows game stats, that kind of stuff, and many popup types of UI scenes. Where multiple can be active at once.
After fiddling with different ways to do things, I ended up using scenes for all UI components.
I have some complex items like scroll panels with many complex items in such scenes, listening to main scene data events, etc.

Some benefits I see with this approach:

Fully encapsulated UI logic & classes with an independent update routine apart from the main scene. It only handles this UI’s specific needs.

Scenes can easily be switched on and off and handle most things just automatically, emitters, update/display lists, etc., and keep state perfectly.

My main scene can be different, but it’s easy to show any UI scene, no matter what the main scene running is.
It’s pretty easy to extend and put common functionality in something like a “UIScene” class.

For me, this works perfectly and gives me a clean separated logic/architecture for all UIScenes.

1 Like

Thanks for the detailed answer!

I totally agree with your points on encapsulated logic and easy switching. Right now, I’m also using a base underlying scene and it’s always on. I launch scenes (which has complicated behavior and logic) on top of this base game scene.