#Reactive scroll rect
1 messages · Page 1 of 1 (latest)
I just found a question about this exact issue on the unity forums which got not even a single response 🥲
Can you describe it with more information? The scroll rect can change size as normal and if the content uses anchors then that can also change too.
e.g. a vertical only scroll rect can have its content anchors be fully separated horizontally to resize with viewport.
I think anchors is what I need, I just can't work out how to set them 😅 I want it basically to have a buffer between the edge of the screen, both sides, on the horizontal edges.
For what, the whole scroll rect or just the content?
You can use the left, right, top, bottom offsets in rect transform to have there always be some px gap from the anchors
The... Content? What's the difference (or is that only for if there's a background or something?
This on the object with the scroll rect?
If you look at the ScrollRect component you can see what "Content" is
You can try this:
Where content is setup like:
If you need height resizing to fit content then this can be done with layout groups
Height I'll need to work out as it scrolls on/off page. Mostly works for click and drag kinda, doesn't work at all for controller
How can I set the anchors like that?
But how can I manually set the anchors?
I should specify, 2021.3 incase it's changed in newer versions
Click and drag them in the scene view
you are not forced to only change it via the rect transform inspector
The blue corners? But that's the size isn't it?
The white triangles
I don't have those 🤔
Make sure gizmos are visible in scene view
How?
I thought those were on by default so I don't think I've ever gone looking for the option lmao
Oh just that button, yeah it's on
Yeah it's all on, but no anchor points
.... It's cause the object was inactive
Why can the size/position be changed but not the anchors 😭
Weird, I can only stretch it up/down, and not to the sides
Oh I can but it snaps back?
Managed to just do all of this by adding padding to the grid layout group
You may have changed your gizmo settings to hide the anchors in scene view but if its working then good