- Home /
Resize Panel Parent with a Text Child
Hi there, so I have a panel with a text child. The child is set to stretch to match the parent size. However, what I want is when the amount of text added to the text increase, the parent panel needs to scale with it.
The panel is the white box, Date_txt is the green text saying "Date" and the NewsContents_txt is the black text. So yeah, the white panel should increase in size down as the black text reaches the end and goes to the next line. I have a content size fitter on my black text so the text goes to the next line, but it does not increase the size of the panel.
Answer by Demonolith · May 13, 2018 at 11:34 PM
Ah I fixed it with this post https://answers.unity.com/questions/1151620/fitting-a-parent-ui-element-to-a-child-texts-conte.html
I added a vertical layout group and a content size fitter to the parent panel.