+7 votes

I have a basic scene setup that looks like this:


I have recently added the camera and figured out how to use it. The problem is that I expected the GUI (GenerateDialog) to move with the camera, but it stays in place. It is set to be in the center of the screen, which works without the camera.

Is this intended behavior? If so, how can I easily make the GUI follow the camera? How do you do this?

asked Feb 26, 2016 in Engine by chuckeles (81 points)

2 Answers

+15 votes
Best answer

Add all GUI elements that need to follow the camera as a child of CanvasLayer.

answered Feb 26, 2016 by Calinou (5,584 points)
selected Feb 26, 2016 by chuckeles

Note: Not CanvasItem.

Thank you for this info :)

+4 votes

That's because you're not looking at Camera in the right way. This would be a better setup:


>Scenery, background tiles etc.

>Something that moves (player?)

>>Camera (so the camera will move with the player)

now you have two choices, you could make the gui a child of the camera so it moves with the camera, or...

>CanvasLayer (puts things at the very top layer even above the camera view)

>>gui stuff

answered Feb 26, 2016 by dc1a0 (215 points)
Thanks. In my case, the player can move the camera directly. I was just missing the canvas layer.
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 How to use this Q&A? before posting your first questions.