This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hey all, I'm trying to add a pause menu to my game but I'm running into the problem where the pause menu is fixed to the initial viewport area and doesn't move as the player moves. My current scene layout is roughly as follows:

  • Game (Node)

    • World (Node2D)

      • Tilemaps
      • Player (KinematicBody2D)
    • PauseMenu (Control)

The issue of course is that when the player moves beyond the bounds of the viewport in the world, the pause menu does not follow the current viewport and so I don't get the menu to pop up unless the player moves back to the starting viewport area.

What's the best way of structuring this so that I can keep everything uncoupled and don't have to resort to e.g. attaching the pause menu to the player's camera or something? I imagine there must be a way of specifying that something always be anchored to the viewport, so to speak. I could also see something like that being useful if I wanted to e.g. apply a shader to the entire viewport.

Thanks in advance for the help!

in Engine by (45 points)

1 Answer

+1 vote
Best answer

Use a CanvasLayer.

by (343 points)
selected by

Brilliant, so simple. Thanks a lot!

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 Frequently asked questions and 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 [email protected] with your username.