Making Menus that remain consistent across various scenes

I was wondering how I could make game menus.

If a game has several scenes that you can transition through, how would I make the game menu remain consistent throughout the scenes.

I think that having to copy and paste every single menu object into various scenes would become really irritating especially when scenes become a lot like 50 or 60.

Is there something like global objects that you can apply to every scene in the game by only Making them an object in one scene?

There are a lot of options. A custom (prefab) object might be the best choice. Maybe combined with external events. Yes, there are global objects. So, the custom object could be made global. Then you could just add the custom object and maybe link the external event.

The custom menu could be as simple or complex as you need it. You could create return events for each menu item or 1 event that would return the name of the menu that was clicked. Sort of like a keypressed condition or expression.

Another option is an external layout. Then the objects could be added all at once.

If you need separate scenes then you can create a template like scene that just has the main setup and then make copies of it.

What kind of project are you working on? Maybe there’s a way to use fewer scenes like through external layouts.

Instead of external layout
I would go with external events
I would make in one scene bunch of events for creating/managing and interacting with menu

And then after im happy with result and i know i not gonna touch it move it to external event
Then i would just include it in each scene
In most cases you want menus to adjust positions based on resolution
So if someone resize window or have different size display
You should make 2 variables to store screen and height with in
Like event with 2 actions without any condition
Above it 2 conditions called compare two numbers
But these you put inside OR statement
And now you check if ScreenWidth() is NOT equal to screen width variable
In other one you have ScreenHeight() is NOT equal to screen height variable

And in action you set some other variable to true for example call it UpdateStuff make it boolean and set it to true

Now somewhere in events below you change position of your all objects to CameraBorderLeft() Right Top or Bottom depending on where it is
And after its done on end you set that UpdateStuff variable to false
This way it will update only when absolutely needed and not spam everything

And rest is just interaction and manage logic
Where you would have event to create all your stuff at beginning of scene
And put it on some layer for example MenuLayer
Hide it by default
And show it only when you need to see menu
And you are done

Only problem with many scenes and deidcated layer for it
You will need to actually created that layer on each scene
I would just have one blank scene with that layer which i duplicate and adjust rest of it if needed

Thanks

It’s a regular side scrolling metroidvania, I was asking simply because I wanted to implement menus for things like a map, tools, collectables and all

Thank you so much for the explanation. Yeah I think external events is the way to go to avoid having to copy and paste events in every scene.

I’ll also do a seperate later for the menus and then just have the opacity set to 0 by default and make it visible when needed. :blush:

Not opacity set to 0
Show/hide layer