• 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
0
Question by epb267 · Feb 08, 2021 at 04:15 PM · user interfacescroll view

Scroll Rect is "weighted" and doesn't let players scroll up very far

Hi folks,

I'm working on a texting simulator game, so almost everything is UI based (blech, I know). Something that's really stumped me is the Scroll Rect component not working correctly. If I try to scroll up on the texting screen, I can do that for a moment, but then the content gets dragged back down again, almost like it's bottom-heavy. This sucks because it means that if players forget what a certain character said during a previous conversation, or if the texts are coming in too fast for them to read, they can't scroll back :/

In my hierarchy, I have a Scroll Rect object. Nested under that is a "content holder" that contains, as childed gameobjects, an object for each conversation. The content holder is specified as the Scroll Rect's content. I'm pretty sure something is off on either my anchor presets or pivots, or I have a box checked on a layout group that shouldn't be. But I have tried SO many configurations and none of them fix the problem.

Here are some screenshots of my hierarchy/inspector settings, and here's a quick video of the issue in action. alt text


alt text


scrollrect2.png (64.2 kB)
scrollrect.png (132.5 kB)
Comment
Add comment
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

2 Replies

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

Answer by thelastelfl · Feb 09, 2021 at 03:24 PM

you should add component "Vertical Group Layout" and "Context Size Fitter" on Content, and set value "Horizontal Fit" and "Vertical Fit" as "Min size".,You should add component "Context Size Fitter" on Content, and set both value "min size"

Comment
Add comment · Show 1 · 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 epb267 · Feb 11, 2021 at 05:29 PM 0
Share

This worked, thanks! Though I think your answer repeats some words - I didn't have to change anything on the vertical group layout, just left it as-is.

avatar image
0

Answer by epb267 · Feb 08, 2021 at 04:16 PM

one more screenshot (I can only include 2 per posts) as well as the only code that messes with these objects.

alt text


  public void WriteText(string text, string characterName, bool isRosa){
             if(text == ""){
                 return;
             }
             Character character = Services.CharacterManager.characters[characterName];
             Transform parent = character.transform;
             GameObject textObj;
             if(isRosa){
                 textObj = GameObject.Instantiate(rosaPrefab,parent);
             }else{
                 textObj = GameObject.Instantiate(conversantPrefab,parent);
                 Services.CharacterManager.characters[Services.InkManager.currentConversant].textingInProgressIcon.transform.SetAsLastSibling();
             }
             textObj.transform.localPosition = new Vector2(0,character.height);
     
             TextMeshProUGUI textDisplay = textObj.GetComponentInChildren<TextMeshProUGUI>();
             textDisplay.text = text;
             character.texts.Add(text);
             character.height -= 0;
     
             textDisplay.DOFade(1f, 1f);
             textObj.GetComponentInChildren<Image>().DOFade(1f, 1f);
             textObj.transform.DOShakeScale(.5f, .03f, 10, 0f, true);
     
         }




scrollrect3.png (124.3 kB)
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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

112 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 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 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

Using the Unity UI system, is it possible to create a scrollrect that fits its content until a max. height is reached (within a panel that fits its content)? 0 Answers

Scrollable panel does not work after disable and enable action 0 Answers

UI System for Non-minimal User Interfaces 0 Answers

Simple UI not appearing once deployed to iOS (4.6.2) 1 Answer

3D Unity-Terrain realtime modifier 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges