Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 e-bonneville · Feb 11, 2011 at 04:11 AM · guiscrollview

Why is my scrollview jittering?

Can anyone detect any obvious problems with the following script?

int loadButtonPos = 30; string[] loadFilePaths = Directory.GetFiles(Application.dataPath + "/models/");

     scrollPosition = GUI.BeginScrollView (new Rect (15,0,loadPopup.width - 30,loadPopup.height - 30), scrollPosition, new Rect (0, 0, 220, 200), false, true);
         for (int i = 0; i < loadFilePaths.Length; i++) {
             string curFile = Path.GetFileNameWithoutExtension(loadFilePaths[i]);
             if (GUI.Button(new Rect(15, loadButtonPos, 200, 10), curFile)) {
                 showLoadPopup = false;
                 LoadData(curFile);
                 saveFileName = curFile;
             }
             loadButtonPos+=35;
         }
     GUI.EndScrollView ();

When I run it, my vertical scroll bar doesn't show up (even when I have far more elements invisible than onscreen) unless I set alwaysShowVerticalScrollbar to true.

When I do that, my scrollview jitters at a very high speed between the top and bottom of the scrollview.

I can't see what's wrong with it, so I hoped somebody else with a non-steamed brain could help.

Thanks - Elliot Bonneville

Comment
Add comment · Show 1
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 e-bonneville · Feb 11, 2011 at 04:26 AM 0
Share

I've found the answer. It seems that my client rect wasn't large enough. :/ I still don't know why that would cause the strange jittering though.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by IgorAherne · Aug 25, 2017 at 02:53 PM

This is an issue form 2011, but I just experienced horrible jitters of my custom script-driven layout elements. I am also getting NaN values in rect transforms & children's rect transforms.

I am strongly convinced it has to do with the internal order in which unity updates the transforms.


For future visitors, this doc explains how to "follow the rules" so that unity is not confused by you updating properties of RectTransforms, while unity tries to drive them according to its Auto-layout:

https://docs.unity3d.com/ScriptReference/UI.ILayoutElement.html

Also check out https://docs.unity3d.com/ScriptReference/UI.ILayoutController.html and in particular the ILayoutSelfController.

Layout calculation rules and order is also discussed here, in the section Technical Details https://docs.unity3d.com/Manual/UIAutoLayout.html


August 2017

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How can I combine a Mask with a Scroll Rect to limit the visible content? 2 Answers

Unity update destroyed my Scrollview UI. How can I restore it? 0 Answers

4.6 GUI Button inside a scrolling Text Box 0 Answers

Can you have a scrollview inside a textfield? 0 Answers

scroll view in iphone 1 Answer


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