Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

Vertical layout with SetAsLastSibling creates a mess

Discussion in 'UGUI & TextMesh Pro' started by arikm, Jun 25, 2018.

  1. arikm

    arikm

    Joined:
    Oct 27, 2013
    Posts:
    9
    I have a form with open source combobox and texts. When clicking on the combobox it calls SetAsLastSibling to open the options on top of other items. Combining with Vertical layout this cause the combobox to jump to the end of the form and cause problems.

    Is there another way to show the options on top without changing the order?
     
  2. FernandoHC

    FernandoHC

    Joined:
    Feb 6, 2018
    Posts:
    333
    depending on the order of your vertical layout group, it will set the object position based on the hierarchy index, so setting sibling index will always change its position.
    Can you avoid calling SetSibling and instead open the contents of your combobox in another panel that ignores layout.

    using textmeshpro dropdown usually works fine for me, not sure which one you are using though.
     
  3. arikm

    arikm

    Joined:
    Oct 27, 2013
    Posts:
    9
  4. arikm

    arikm

    Joined:
    Oct 27, 2013
    Posts:
    9
    BTW, my mistake, I'm having problem with AutoCompleteComboBox, otherwise I would use the TMP dropdown..
     
  5. FernandoHC

    FernandoHC

    Joined:
    Feb 6, 2018
    Posts:
    333
    In this case, I would try to work out the UI hierarchy to have the object be child of an ignore layout parent without layout group. So setting sibling index wouldn't cause any automatic changes.
     
  6. arikm

    arikm

    Joined:
    Oct 27, 2013
    Posts:
    9
    I can't use ignore layout. Anyway, setting the AutoComplete a child do cancel the effect of SetSibling and cause the open combox to be under other elements and not topmost.
    Maybe there's elegant shader solution for topmost although its 2D.