How do I make a dynamic back button?

Godot Version

4.2

Question

Newbie here - I’m trying to make a settings menu that can be accessed by the pause menu and the title screen. How do I make the back button take you to where you were before? I’m using a different scene for the settings menu than the title screen or pause menu.

That could be a little complicated. You would need to store a history of menus. And swap back to the previous one.

You would most likely make this feature in the area that swaps menus.

Since history can be thought of as a “stack”. You can use an array to push and pop menus in the stack. Push when you select an option to a new UI scene. Pop when you press a back button.

You can use animation player for the transition of pause menu to settings, not scene changing

How do I do that?

Let when you press on the play button, the starter ui moves left and level selection menu comes in the screen from right then you will need an animation player. If you want from pause menu to settings then you can just codes that pause_menu.hide(), settings.show(), if animation player then create the animation of the movement I have mentioned, so when player press on play button it will play the animation “menu-to-levels” and if he back to the menu then play backwards the same animation