General best practices for popup menus

I’m working on a chess game and, for pawn promotion, I want to instantiate a popup menu (which is a Control node) to select the new piece, after selecting the new. For these kind of menus that interrupts the game and resume it after you make a decision/selection, what are the best practices? Should they be on their own CanvasLayer? How do you make the game wait for the input of the player to continue with the flow of the game?

Just for contexto of my case, at this moment, I have this Main scene that has the Game scene (where the chess game happens) and a CanvasLayer for GUI elements. That GameInfo I’m basicaly using for some debug info right now, but it should have stats and information from the game in progress later.


Should I place the promotion panel inside of the Game scene or in the GUI? What do you reccomend?

canvasLayer is just meant so that the UI doesnt on the same layer of the game 2d, so it wont be affected by z-index of your 2d game because always render on top of it.

if your game has no timer, and probably an offline game, then you can just block input by putting a full rect control behind the actual window content. Popup menu usually can be closed/ignored, for things like what you want, i call it a prompt window. Godot also made two kind of pre-build window and popup, window where user are forced to interact with it while anything under it is not reachable as long as the window exist, while popup is you can close it wherever you click that is outside the popup menu

1 Like

Pausing games and process mode — Godot Engine (stable) documentation in English shows a mechanism for pausing the game :sleeping:.

Regarding the CanvasLayer question:
Placing UI elements on their own CanvasLayer ensures they remain independent of the 2D game layer, preventing interference with z-index values and consistently rendering on top.

For the player input delay:
In a timer-less, offline game, you can halt input by placing a full rect control behind the main content, creating a prompt window that blocks interaction until resolved, distinct from dismissible popups in Godot :grinning:.

1 Like

Just wondering, why do you not using the PopupPanel node?

because it’s a window thing, probably caused more lag from using any built-in windows godot offered

i used them before, it’s much smoother for creating our own window

From what I can remeber, Popup will close whenever you click anywhere in the window, I don’t want that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.