Hi,I am trying to fix my label in a particular spot . I have scavenged the internet for answers and I am very new to Godot and programming . Any support will help . Thank you in Advance
How do I make a label fixed ?
Could you perhaps tell us a little about the structure of your node hierarchy and perhaps give a visual example of how you would like your label to be?
If you make the label a child of a Node2D, then I think it will ignore the anchor positioning and will stay fixed relative to the position of its parent Node2D.
- Edited
Thanks a lot !!!
It doesn't work , perhaps you guys got my question wrong or I didn't frame it properly. I want my label to move with the camera 2d .
Oh, in that case, there are two ways you can do this easily, depending on your project and what you are looking for.
The easiest is to have the label node as a child of the Camera2D node. Then move move/translate it to whatever position you want it to be fixed to. Then it should stay relative to that position.
The second way is to use a Control node with the anchor set to full rect
, and then have the label as a child-node of that Control node. Then you can set the anchor of the child label node to whatever corner/position is closest to where you want the label to stay with a scaled screen.
To set the anchor easily in the editor, when you select a Control node there should be a dropdown called Layout
, if I recall correctly, which allows you to set the anchors.
Additionally, you'll need to go to the project settings and set the scale mode. I think its project settings -> display/window -> expand mode
. There should be two options: 2d and viewport. There should also be settings there to handle different aspect ratios.
I think either method should give you the same result. I have not had the time to test either, but I think I've used both in various projects and its worked okay.
You can also make your Label a child of a CanvasLayer.