Search Unity

Dynamic width based on text width

Discussion in 'Game Design' started by Aleshinho, May 11, 2018.

  1. Aleshinho

    Aleshinho

    Joined:
    May 8, 2017
    Posts:
    2
    I would like to place a container in the middle of the other container like on the image bellow. unity desired layout.png 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).