ScrollRect : always 3 screens wide, regardless of aspect ratio

Expected
I want a ScrollRect for 3 screen-widths of content.
The user is able to press a button to have the it automatically switch between them (no dragging)
The 3 screens need to match the Device’s width
Issue
When I switch from iPhone 5 aspect ratio to a wider ratio, the HorizontalScrollRect RectTransform Right stays -1280. The elements inside change width (i suspect to accommodate the new aspect ratio) but are not wide enough to cover the entire screen.

I’ve tried a bunch of different layout setups, but not finding anything that matches the elements to the screen size. I would do it in code, but the size is somehow related to the Canvas scaler in a way that i’m not easily seeing.

The Canvas is setup to use the (very narrow) iPhone 5 Portrait Mode as the base resolution.

HorizontalScroll

HorizontalScrollRect (the content for the ScrollRect)

And this is one of the screens

The element when in iPhone 5 resolution

The element when switching to iphone 6 aspect ratio

What happens if you make the canvas scale match width only?

You were absolutely right, Thank you.

But what if I really did need to match to ether Height/Width and still get the right screen width?

Found the correct solution for anyone who comes through later

The Anchor needed to be set to 3x the screen width and there should be zero offset from there (this is where the aspect ratio changes threw it off)

1 Like