Search Unity

Combined ScrollRects problem.

Discussion in 'UGUI & TextMesh Pro' started by Pontik, May 18, 2016.

  1. Pontik

    Pontik

    Joined:
    Feb 26, 2014
    Posts:
    17
    Hello,

    we have a problem to combine 2 or more ScrollRect components together (http://shot.qip.ru/00NDav-3oHGoulTP/). If you slide to the left or rigt in the child Scroll Rect with a list in it we want to translate this movement to the MainScrollRect, but if you slide to the top or bottom in the childScrollRect it have to slide the list in it.

    Is there a way to do that? How to translate the left/right drag action on the childScrollRect to the mainScrollRect?
     
  2. Pontik

    Pontik

    Joined:
    Feb 26, 2014
    Posts:
    17
    Solved.

    On childScrollRect:
    void OnDrag(PointerEventData eventData)
    {
    mainScrollRect.content.anchoredPosition.x + eventData.delta.x​
    }
     
  3. DaveWill

    DaveWill

    Joined:
    Apr 22, 2016
    Posts:
    4
  4. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    There is also the newly proposed ScrollConflictManager however I've not tested it's full capabilities as yet. The author suggested it was made to handle such situations of nested scrollRects
     
  5. Pontik

    Pontik

    Joined:
    Feb 26, 2014
    Posts:
    17
  6. Pontik

    Pontik

    Joined:
    Feb 26, 2014
    Posts:
    17