Search Unity

[ugui] How to ScrollRect get center item index

Discussion in 'UGUI & TextMesh Pro' started by hmpark, Sep 23, 2015.

  1. hmpark

    hmpark

    Joined:
    Jan 17, 2014
    Posts:
    1
    How to ScrollRect get center item index

    ScrollRect
    - Content
    -- Item1(0)
    -- Item2(1, center item)
    -- Item3(2)
    -- ...

    to scroll

    ScrollRect
    - Content
    -- ...
    -- Item10(9)
    -- Item11(10, center item)
    -- Item12(11)
    -- ...

    Answers, please.
     
  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    You should simply need to count the siblings of the ScrollRect and then get it's local transform, either that or set the Scroll Value to 50%. Depending on what you need.