Search Unity

Still having trouble with ScrollBars

Discussion in 'UGUI & TextMesh Pro' started by nventimiglia, Aug 27, 2014.

  1. nventimiglia

    nventimiglia

    Joined:
    Sep 20, 2011
    Posts:
    153
    I have a scroll view with dynamically added items. When I add items to the scroll It works perfectly. When I register a scrollbar to the scrollview the scrollbar will zoom to the bottom of the container whenever items are added. It is very annoying.

    Here is a gif presentation.
    http://i.imgur.com/6E7xzWE.gif

    I also noticed that when the scroll view breaks my scroll container position, it is moved to -400 or so (at the bottom of the scroll view) I think this might be involved for some reason.

    Here is my add code

    Code (CSharp):
    1.  IEnumerator AddAsync(IEnumerable<object> objects)
    2.         {
    3.             foreach (var obj in objects)
    4.             {
    5.                 yield return 1;
    6.                 OnAdd(obj);
    7.             }
    8.  
    9.             yield return 1;
    10.         }
    11.  
    12.  
    13.  
    14.         GameObject GetNext()
    15.         {        
    16.                 var next = Instantiate(Prefab, RectTransform.position, RectTransform.rotation) as GameObject;
    17.                 next.transform.parent = RectTransform;
    18.                 // idk, scale sometimes goes wierd
    19.                 next.transform.localScale = RectTransform2.localScale;
    20.                 next.SetActive(true);
    21.                 return next;    
    22.         }
    As you can see I am doing nothing to adjust my scroll or my container. Why is it moving on me ?

    Edit

    The issue only happens when you activate the scroll panel after load. My original bug-only prototype was working because it started active. When I started the scene with the container inactive then activated it in code - it broke. Uploading sample.

    https://drive.google.com/file/d/0B_kXglJqPnm_SURjbVBHYXFKZjA/edit?usp=sharing


    Case 629305
     
    Last edited: Aug 27, 2014
  2. cowtrix

    cowtrix

    Joined:
    Oct 23, 2012
    Posts:
    322
    Yeah I'm encountering this too. Kind of annoying - it would be great if we could make scrollbars "sticky" (i.e. they don't change position without player input).
     
    nventimiglia likes this.
  3. Riolis

    Riolis

    Joined:
    Aug 23, 2014
    Posts:
    8
    Yep, same thing happen to me, and I can't find a way to fix it. And its very frustrating.

    My scrollview started active tho, added the item to grid layout after I got some data from server, and it will scroll itself to bottom. (which is useful for chat window, but not on the other ones.)
     
    nventimiglia likes this.
  4. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Thanks for the bug report! We'll look into it.
     
    Xaurrien and nventimiglia like this.