Layout issues - ScrollView and Vertical Layout Group

Hi,

I have a Vertical Layout Group with a Content Size Fitter, with children a TextMeshPro and a ScrollView.

(The TextMeshPro is not a problem, I only put it to show that I needed a Vertical Layout Group, so let’s forget that)

Inside the ScrollView I have another Text element. This Text element expands both vertically and horizontally. I want the horizontality to be scrolled by the ScrollView and I want the ScrollView to adjust to the height.

So I want the ScrollView to be the same height as all of its internal elements. this is my goal. I don’t want a scripted solution, I want to be able to do it directly from the hierarchy, where you define the layout of all elements.

However I am not able to do this, my idea was to put the Vertical Layout Group with a Content Size Fitter in the ScrollView, but if I do, I can no longer scroll the text horizontally, as it is constantly realigned based on the alignment defined in the Vertical Layout Group.

ps. At first you might think, but a text with a horizontal Content Size Fitter does not stretch vertically, what need is there to enlarge the ScrollView based on the height of the text? In reality I don’t really use the Text component, I use a similar component created specifically for particular fonts, which also expand the text vertically, for this I need that the height of the ScrollView dynamically adapts to the child components, but I repeat, with a Vertical Layout Group, then I can’t scroll anymore.

Solutions?

I had done well the layout system. Disable Pixel Perfect on Canvas fix the problem of the text realignment.
I don’t know if this is the expected behaviour, i will send a bug report and i will update this thread when i will receive any response.

FYI: There’s a dedicated UI forum here where you’re more likely to get UI help.

1 Like

I was undecided whether to post it there or here, thanks for the tip

It’s not so much a problem posting here but a dedicated forum is often better. I am happy to move it if you wish me to do so.

If it doesn’t waste your time it would be appreciated, thank you!

1 Like

Here the response: