I read the docs, watched a couple videos and still cannot get this to work.
I’m not sure if I am doing things wrong or if Unity broke it. Hopefully it is just me, but since they already broke UI rendering to texture in 5.4.x and I had to revert to 5.3 and in 5.3 I see UI elements not updating in the editor at times, I wouldn’t be surprised if this is broken too.
Basically, I’m trying to create a horizontal scrollview with a bunch of elements inside, each taking up the whole ‘viewport’ dimensions and have the ‘content’ of the scrollview both resize dynamically depending on the number of elements and also apply horizontal layout to the items.
I’m including a sample project and even a video of it (inside the zip attached).
The gist of what I tried is:
- Create scrollview from UI menu (notice now there is a new ‘scrollview’ as opposed to ‘bare’
ScrollRect– but I also tried with the
- The default scrollview object from the menu assumes as vertical layout, so I changed the content’s transform to flexible height and absolute width.
- Added a bunch of images to the scrollview’s content, with layout element components with a min width equal to the scrollview’s width.
- Tried adding horizontal layout group and / or content size fitter to scrollview’s content.
The problem is that the content does not resize, staying always at exactly the size of the viewport. Tried the content fitter too… same thing.
Any help would be gladly appreciated. Thanks!