Keep position of UI while using Horizontal Layout Group and Content Size Fitter

Hi there,

I am trying to design a nice menu with some features including localization. However, I might need some help about UI elements.

I am doing a menu with some buttons that are detached from the left side of the screen (so that there can be a cool little space) :

I was thinking about localization when I realized that, according to the language chosen by the player, the button width (meaning here the clickable area) would not be in accordance with the text width. That is why I used Horizontal Layout Group and Content Size Fitter thanks to Unity tutorial at part “Fit to size of UI element with child Text” and it fitted my expectations really well.

But I have a little problem, I suppose it is about anchors or something like that : when I change the text of a button (for example purpose), my button is completely offset from his initial position (the red arrow on the first screen, this cool little space you know) :

Is there a way to “keep the left side of a button” at a specific place and keeping at the same time the Content Size Fitter to expand to the right side ? Here is a visual of my expectation.

Thanks in advance for help :slight_smile:

Solved !

According to the Content Size Fitter doc page, moving the pivot of my buttons put correctly the button position after changing the text.

I had to put the pivot on each button by (0, 0) to keep the left side of my buttons at their place. :slight_smile: