+3 votes

I have a basic scene setup that looks like this:

Scene

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 (77 points)

2 Answers

+6 votes
Best answer

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

answered Feb 26, 2016 by Calinou (2,518 points)
selected Feb 26, 2016 by chuckeles
+1 vote

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

Scene

>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 (209 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.