UI Nodes Good Practice

Godot Version

4.3

Question

Just a quick question would you say it’s a good way to have all of the UI elements that would appear on the screen like a Pause Menu, Game Over Screen… under control nodes like this?

Screenshot_1

I read that the Control node is the base class for all Gui controls and I thought since I have different UI scenes I should use them for each one or I am making a mistake? Some of the tutorials I have seen they go with the direct menu and some have this way of building so I wanted to ask before I went too far into the UI creation.

This is a totally normal way of doing it. The root-node of all my ui-scenesare Control-Nodes

1 Like

I really like using a simple Control node for all things that is displayed on the 2d screen.
You can make a system out of it

  • base grey nodes for code-instances like managers (GameManager, AudioManager, NetworkManager, etc)
  • blue node2d nodes for main scenes (level_templates, unit_containers)
  • green Control nodes for all UI things (overlays, textboxes, menus)

but then again, everyone has their own system that they feel most comfortable with

2 Likes

Btw, if you want to be extra fancy then you can give each specific node type their own icon. So it doesn’t have to be a colored circle, that’s boring.
Add this to the top of your script

@icon("path/to/your/icon.png")
1 Like

Thank you, I also was going with that mindset.
Green - UI
Gray - Code instances
Blue - Scenes

But I thought that I was going around everything the wrong way. I am happy that at least I was on the right track. Also I didn’t know about the last one for sure!!

1 Like

there is really no right or wrong with design structuring decisions like this, you can always refactor if it bothers you down the line. Everything is learned by trying out and then slowly building a system that is convenient and effective for your own style :ok_hand: