+1 vote

I might be misunderstanding how the node hierarchy works. But so far in the engine it seems that nodes generally move in relation to the parent but this seems to be an exception. I expected that setting a UI button as a child of the Camera2d would cause the button to remain in place on screen as a hud item. Despite this the button moves in relation to the camera's parent and not the camera itself. The button seems to behave as if it was a child of the camera's parent which in this case is the player. Could somebody help me understand why my expected behavior isn't correct. and how I could resovle it?


asked Jun 22, 2019 in Engine by tailgunner90 (15 points)

1 Answer

+2 votes

Dunno why it works like that.

But the best practice is to add your HUD controls as children of a CanvasLayer if you want them to stay put on the screen.

answered Jun 22, 2019 by Dlean Jeans (3,911 points)

Ok make a canvas layer in your world, completely separate from the camera and everything else, and attach controls and other elements under it.

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.