UI crosshair centering

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wooshuwu

I am trying to make alignments for a UI, but the typical operations are not working like I am intending and I am unsure why. For example, when I do the “center” option from a control node’s layout option, the node doesn’t center in the Editor’s blue box, it goes up someplace beyond the blue box for some reason. I have tried resetting the margins, anchors and rect properties of the node in the inspector but the same thing still happens, all the resetting does is move the node’s top left corner to the top left corner of the blue box. The node’s size is small and can fit within the blue box easily, I am not sure why the layout options are not working properly. Is there a property I am not considering or something else I can do to fix it? I think this has something to do with the fact that the node’s crosshair (orange) is at it’s top left corner rather than it’s center but I don’t know how to change that.

:bust_in_silhouette: Reply From: SF123

Ok, I have had this problem in the past. Try using Control nodes if you are just using a basic Node2D or something!

:bust_in_silhouette: Reply From: TheIronGod

What blue box are you talking about? Control nodes use different position coordinates than 2D nodes… but I need more detailed information than your question gives to answer better. Still, I asked a similar question and the answer may help you if you need to line those coordinates up.

https://forum.godotengine.org/81684/telling-a-control-node-the-position-of-a-world-node