Can't use horizontal layout with ScrollRect scrollview in Unity 5.3.3f1

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.

Essentially this:

I’m including a sample project and even a video of it (inside the zip attached).

The gist of what I tried is:

  1. Create scrollview from UI menu (notice now there is a new ‘scrollview’ as opposed to ‘bare’ ScrollRect – but I also tried with the ScrollRect).
  2. The default scrollview object from the menu assumes as vertical layout, so I changed the content’s transform to flexible height and absolute width.
  3. Added a bunch of images to the scrollview’s content, with layout element components with a min width equal to the scrollview’s width.
  4. 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!

Here you can use Grid Layout group instead Horizontal Layout Group with Content Size Fitter as follows

Go to Hierarchy–>Canvas–>ScrollView–>ViewPort–>Content
Attach GridLayoutGroup and ContentSizeFitter component to Content object and set parameters as shown below


Here cell size is the size of ScrollView.

Now you can add elements dynamically to Content gameobject and content will resize automatically allowing added elements to be fixed sized(Cell size of GridLayoutGroup).

You can refer attached package