Search Unity

Is it possible to disable a layout group temporarily ?

Discussion in 'UGUI & TextMesh Pro' started by proto_monkey, Jun 8, 2015.

  1. proto_monkey

    proto_monkey

    Joined:
    Jun 7, 2015
    Posts:
    18
    I have a UI Canvas (ScreenSpace - Overlay) with a Vertical Layout Group that has three UI panels as children. (See below image for reference)

    What I'd like to do is have each panel slide/fly off the screen. Then they will slide/fly back on the screen at a later time.

    My question is if this is possible ? I have tried to animate/move a panel over time off the screen, but I think the Layout Group is likely in control of it, therefore it doesn't move.

    Is it possible to disable the Layout Group / Auto Layout functionality and do this :

    Disable Auto Layout
    Save location of panels
    Animate them off the screen
    Do Something - for right now , this is just a 2 second pause
    Animate them back on the screen
    Enable Auto Layout again

    Is this futile ? :) - if so, let me know what is the better approach.

    default-layout.png
     
  2. Daybreaker32

    Daybreaker32

    Joined:
    Jun 11, 2014
    Posts:
    73
  3. proto_monkey

    proto_monkey

    Joined:
    Jun 7, 2015
    Posts:
    18
    I have the LayoutElement component added already, and sadly when it's removed the positioning gets messed up as the autolayout tries to adjust for each element as it's ignored.

    I think I am going to go the WorldSpace route as this layout system seems to not be suited for what I am trying to do.
     
  4. Daybreaker32

    Daybreaker32

    Joined:
    Jun 11, 2014
    Posts:
    73
    oh i thought you need to have the autolayout readjust the other element position when disabling the one you need.
    how about set the enabled variable from the auto layout to false?
     
  5. proto_monkey

    proto_monkey

    Joined:
    Jun 7, 2015
    Posts:
    18
    There's a cascading effect, as my full situation is a bit more complex than what I isolated here. Every time I disable something, that level readjusts. The autolayout doesn't seem to be designed to have elements go outside of it's encapsulation. It's kind of like tables in HTML.