- Home /
Dynamic width based on text width
I would like to place a container in the middle of the other container like on the image bellow.
The middle container would have 2 elements. First would be text that would represent price ("####" on the image), the other would be image of a coin (blue circle) with a constant width (yellow arrow). How can create this kind of gui knowing the price will increase, consenquently the width of inside container (red arrow) should as well? With changing of a price I would like to keep inside container to be centered ("a" on the left would be same as "a" on the right).
Answer by Vicarian · May 12, 2018 at 11:08 AM
If this goes on a Canvas, use a HorizontalLayoutGroup. See the Manual on how to use the LayoutGroups. Experimentation is the way I learned them.