Topic was automatically imported from the old Question2Answer platform.
Asked By
EIREXE
Old Version
Published before Godot 3 was released.
I’m trying to anchor a button to scale horizontally with the viewport, and I’m using stretching mode disabled, however my control does not seem to respond to anchors at all, it’s anchored as “End” to the right, yet when I scale it horizontally it just stays there.
I think this little tidbit should have been included in the Godot documentation about anchors & margins. Would have saved me the past several hours trying to get things to work correctly parented with Node2D or Control nodes.
It is working fine for me, I think you might ran into the same problem as me.
Anchor is working only if that ui control is child of ConvasLayer. if it is not child of ConvasLayer then it will show incorrectly for different screen size.
I experienced this quite often till I realized the problem was that I was resizing UI elements that were not the root node.Resizing a child node affects the anchoring as the parent node still keeps the original scale of the child node.So if you need to resize your UI element do it ONLY with the Root node of your scene.