UI 4.6 : Anchor to dynamic text ?

Hi everyone.

I’m trying to anchor a UI component in 4.6 to the END of a text. I can anchor it but into the text square (right, bottom, top, left), but of course it doesn’t move when the text change, cause the square never resize.

So how can I anchor a UI Component to the end of a text ?

IF NOT, may be you can help me find another solution : i’m trying to display a text like this : “Laboratory level 10”. The “Laboratory” part has a big font size, and the “level 10” has a small font size. So I can’t put them into the same Text component if I want two different font size, right ? That’s why i’m trying to anchor “level 10” to the end of “Laboratory”.

Did some one got an idea to achieve this ?

Thanks a lot.

Can’t you just set Align in the Laboratory to right?

So the end of the, presumably room name, is always next to the level number.

![1]

EDIT

Thought you probably had too much Karma to not thought of that but you never know.

Try adding Content Size filter and set Horizontal to Preferred Size and it should re-size the RectTransform of the Text to fit the text inside it. Set the pivot to the middle left so it always grow out to the right.