Is there a straightforward way to align nodes with their parent in gdscript like you can in the editor's "layout menu"?

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

I tried looking around and the information for this seems to be outdated and doesn’t work.

The parent node is a polygon2d and I’m trying to center a label to it after being resized to fit the polygon, which i did by adjusting the margins to the respective vectors of the polygon (It works for the resizing regardless of the label’s position but the label ends up way off center).

Are you able to share the project? I imagine the center is not always where it looks like it is in a polygon that somehow changes so there is probably some cleaver way to calculate that if needed

flurick | 2019-09-11 20:09