- Home /
Scroll rect starting in the middle
Hi Unity Community
I am trying to create a scroll functionality for text which is updated at runtime using the scroll rect and UI scrollbar. This works, however it currently starts with the Text rect positioned at the middle, whereas I obviously want this to be positioned at the top.
It’s a small but annoying issue that I can’t seem to solve using the Unity UI system. Any advice would be very welcome on how to resolve this.
Cheers, Ryan
Current start position (text rect):
Text Editor Setup:
The text rect is governed by the scroll rect whose setup is detailed below:
Scroll Rect Editor Setup:
If all else fails, you can set the ScrollBar's Value manually in Start().
@Cherno yeah I tried that; as the text field is updated at runtime this seems to be overridden by some of the inherited properties from parent Layout components...can't seem to work around them
Answer by digzou · Oct 28, 2015 at 07:05 AM
Set the 'Y' Pivot of your description text to '1' if you want it to align to top. It is aligning to centre since your pivot y value is 0.5. Here's copy of my scrollContent if you need for some help.
@digzou thank you so much! Setting the Text rect pivot to 1 solved the issue.
Thank you @digzou I'd been trying to figure this out with a similar scroll panel setup!
Thank you so much! You are truely a life saver. Beautiful human.
Thanks a lot. I've wasted so much time playing with layouts to make it work.