Search Unity

Switch between Selectable Panel

Discussion in 'Scripting' started by Sylon87, Oct 22, 2019.

  1. Sylon87

    Sylon87

    Joined:
    Aug 20, 2018
    Posts:
    196
    HI Everyone!

    i have a prefab that should be a inventory, this inventory have a tabs, inside every tabs there is a selectables, buttons, toggles etc...

    there is is a script to control every tab visibility on the top object, and a selectable inherited script on every tab,
    what i want is that for example when i scroll the button inside one single tab and i come to the last button inside that tab, i want to switch automatically to the next one, anyone know a good way to do this?

    what i i thinking is to put a canvas group to every single tab, and set the alpha to 0 when is time to switch to the next one, from there i can also cut out the interactable function so should be the right way... anyone know a better way?
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    When you scroll down there's scroll event. If you set scroll mode to unlimited for all pages except last, you can check value in scrollers OnScroll event, and if that value is greater that 1, you switch to next tab. There's no built in solution since this is not very common thing you want.
     
  3. Sylon87

    Sylon87

    Joined:
    Aug 20, 2018
    Posts:
    196
    Thank’s you!

    i’ll check out your solution!