GUI Not Following Camera?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By chuckeles
:warning: Old Version Published before Godot 3 was released.

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?

:bust_in_silhouette: Reply From: Calinou

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

Note: Not CanvasItem.

Aaron Franke | 2019-03-01 08:33

Thank you for this info :slight_smile:

PseudoC0de | 2019-05-24 01:55

Argh. I spend an hour twiddling with viewports to no avail instead. Luckily I googled in time for this answer :slight_smile:

Rev | 2022-08-19 09:17

:bust_in_silhouette: Reply From: dc1a0

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

Thanks. In my case, the player can move the camera directly. I was just missing the canvas layer.

chuckeles | 2016-02-27 00:02