• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
23
Question by RyanAchtenSoma · Oct 27, 2015 at 09:05 PM · uitextrectscrollbarscroll view

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): alt text

Text Editor Setup: alt text

screen-shot-2015-10-28-at-94905-am.png (47.2 kB)
screen-shot-2015-10-28-at-95125-am.png (56.5 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RyanAchtenSoma · Oct 27, 2015 at 09:07 PM 0
Share

The text rect is governed by the scroll rect whose setup is detailed below:

Scroll Rect Editor Setup: alt text

screen-shot-2015-10-28-at-95143-am.png (40.9 kB)
avatar image Cherno · Oct 28, 2015 at 12:48 AM 0
Share

If all else fails, you can set the ScrollBar's Value manually in Start().

avatar image RyanAchtenSoma Cherno · Oct 28, 2015 at 04:22 AM 0
Share

@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

2 Replies

· Add your reply
  • Sort: 
avatar image
82
Best Answer

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.

alt text


scrollrect.png (42.8 kB)
scrollcontent.png (47.7 kB)
Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RyanAchtenSoma · Oct 28, 2015 at 08:53 PM 1
Share

@digzou thank you so much! Setting the Text rect pivot to 1 solved the issue.

avatar image Firemaw RyanAchtenSoma · Apr 17, 2018 at 01:50 AM 1
Share

Thank you @digzou I'd been trying to figure this out with a similar scroll panel setup!

avatar image AbdulRaman · Jun 07, 2018 at 09:37 PM 1
Share

Thank you so much

avatar image Vishvesh8 · Dec 25, 2019 at 03:47 AM 0
Share

Thank you so much!

avatar image cupcake007 · Feb 27, 2020 at 09:36 PM 0
Share

Thank you so much! You are truely a life saver. Beautiful human.

avatar image SanyaBane · Jun 27, 2020 at 09:46 AM 0
Share

Thanks a lot. I've wasted so much time playing with layouts to make it work.

avatar image
0

Answer by Refugio3D · Nov 24, 2019 at 02:48 PM

Perfect,thanks soo much

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

49 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

4.6 UI Text rect does not expand automatically 2 Answers

Automatically resize scrollview based on vertical text length (Solved) 2 Answers

Text Preferred Height not expanding even with content size fitter 0 Answers

Changing the scale of the scroll view 1 Answer

How do I Make TextMeshPro InputField scroll through code? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges