Search Unity

Sibling index of VE

Discussion in 'UI Toolkit' started by BinaryCats, Jan 9, 2020.

  1. BinaryCats

    BinaryCats

    Joined:
    Feb 8, 2016
    Posts:
    317
    Hello,

    Is it possible to get the sibling index of a given Visual Element?

    I often work with lists (My needs extend beyond ListView functionality) and I want to now what index the VE corresponds to in the list. Currently I have to loop through the list, and look for the matching object to find the corresponding list item.


    Thanks

    --Edit--
    I've just noticed the IndexOf function, but doing this seems,uh silly,
    Code (CSharp):
    1.             ListItem.parent.IndexOf(ListItem)
    2.  
    Especially when Transform has a siblingIndex property