Search Unity

ScrollView problem, Please help.

Discussion in 'Scripting' started by matiasgil, Nov 19, 2012.

  1. matiasgil

    matiasgil

    Joined:
    Mar 5, 2012
    Posts:
    28
    Hi, im having some issues with scrollview, im doing the "terms and conditions" scene of a game. Im using scrollview to show a large document. The problem is that the scoll isnt going all the way down, its showing everything but when it gets to the bottom of the document the scroll thumb its only at 3/4 of the bar, and you cant scroll it down anymore. Any ideas why is this thing happening?, heres my code:

    Code (csharp):
    1.         GUI.skin.verticalScrollbarThumb.fixedHeight = 20;
    2.         GUI.skin.verticalScrollbarThumb.fixedWidth = 20;
    3.        
    4.         GUI.skin.verticalScrollbar.fixedWidth = 20;
    5.        
    6.         scrollPosition = GUI.BeginScrollView (
    7.             new Rect (0,0,840, 420),    
    8.             scrollPosition,            
    9.             new Rect (0, 0, 819, 1903)      
    10.         );
    11.    
    12.         GUI.Label(new Rect(0,0, 819, 1903), "", "BasesText");
    13.        
    14.         GUI.EndScrollView();
     
  2. matiasgil

    matiasgil

    Joined:
    Mar 5, 2012
    Posts:
    28
    Any help please?
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    If I could really honestly help you, I'd help you by saying don't waste your time with Unity's built in GUI and invest in NGUI.
    You will save yourself a lot of headaches and hassles.
     
  4. matiasgil

    matiasgil

    Joined:
    Mar 5, 2012
    Posts:
    28
    i definitely will, but in my next project, since ive already used built in gui in all the project. Is this a bug of the gui or just a problem of the code?
     
  5. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    I've the same problem. I've built my UI out of Unity's tools, but the vertical slider only uses the top two thirds. It's basically not calibrating correctly to the page size. How come no-one else seems to be bothered by this?! Is no-one using Unity's GUI functions?

    Edit : It appears to be a bug with statically sized scrollbar thumbs. The scroll limits are determined for a freely scaled thumb (where its size represents the page view size relative to the total scrollview size), but the fixed size thumbs stop at the top end of this scroll position.

    The solution is to not use fixed-size thumbs, by leaving the Fixed Size field empty for the corresponding slider direction (Fixed Height left at 0 for a vertical scrollbar).

    I suppose the reason no-one's bothered by this is there's little reason to not use automatically scaled sliders. In my case, I felt a fixed thumb was a more apt style for the UI, but it doesn't make a great deal of difference.
     
    Last edited: Jul 19, 2013
  6. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    No, most people use NGUI or EZGui
     
  7. tonyd

    tonyd

    Joined:
    Jun 2, 2009
    Posts:
    1,224
    There are plenty of people using the built-in GUI. Why?

    Because it's easy to use; you can't get much easier than this:

    Code (csharp):
    1. if GUILayout.Button("Show Menu"): displayMenu = true
    It's powerful... if you know what you're doing, you can do some rather complex things with very little code (like make a code editor which is only 200 lines long).

    And while it's not fast, it's often fast enough... my last iOS game used the built-in GUI for just about everything, and runs fine.

    NGUI or EZGui are good tools, but not everyone needs them, and before you spend one or two hundred dollars for a third party plug-in (which often bring their own issues), it pays to spend a little time with the built-in GUI system and see what it can actually do.

    I haven't run into this particular problem, but if you think it is a bug, please report it.

    http://unity3d.com/BugReportingFAQ
     
  8. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    Have you a UI you could test for reproduceability of the bug? If you have a project with a scrollview, try setting the fixed size of the scrollthumb. If I'm right, it'll get stuck from reaching the bottom. If you can confirm the problem, I'll file an official bug report (I've reported a few bugs on other programs before only to find I missed something and it was my fault, so I prefer independent corroboration so as not to waste anyone's time! ;))