+2 votes

I'm having a bit of a problem with making sure that the pause menu ends up at the middle of the screen no matter where my character moves to. I have a rigidbody2d node with a camera2d attached to him so that it follows my character around. In that i grab that camera from my pause menu script and call the function getcamerascreen_center() to set the position of my pause menu but that function does not center my pause menu it is off center more to the right and bottom of the screen. The camera does have an offset but even when i set the offset to 0,0 it still does not center the pause menu.

Any help with this issue would be appreciated. Here is a bit of code that should center the pause menu to the screen.

func _input(event):
in Engine by (29 points)

1 Answer

+3 votes
Best answer

I think you need to place your pause menu into a CanvasLayer. CanvasLayers are independent of tree order, and they only depend on their layer number.
With this, you don't need to worry about the camera position.


by (155 points)
selected by

That did the trick thank you.

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 webmaster@godotengine.org with your username.