0 votes

In my game I want the 3d game world to be present in most (but not all) menus, like settings, gameplay, game-over-menu (but not in shop menu for example).
I was thinking of creating each menu separately then having a "HUD manager" script handle which menu should be active.
Is there a better way to do this?
Also there are ui elements that shoudl be present in mroe than 1 menus, for eample the money.
I feel like putting them all in 1 scene and activating elements (or groups of them) would be a mess.
What is the best way to implement this?

in Projects by (144 points)

1 Answer

0 votes

I'd approach this by having 'HUD manager' as a new scene then parent shared items in a control node. Have all the other menus under control nodes also and reorder them so the 'shared items' control node is at the bottom so it will be on top of the other menus, from there you can then toggle their visibility and use if menuexample.visible: to activate them.

by (3,141 points)

And how would you approach connecting them to signals? For example, I have a label that shows coins, that should should be increased whenever "coin picked up" signal is emitted.

The signal would be connected to the coin, reference the HUD manager and add the coin's value to a variable on the HUD manager.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories