Joel Hager
Joel Hager

Reputation: 3440

Unity grid system woes (How to make grid that auto-collapses to column in portrait mode

My problem is very difficult to describe, so hopefully (with the pictures I provide) someone can help me figure this out. If you are confident you can fix it, I'm willing to pay if I have to. I need this fixed.

I cannot for the life of me figure out how to work with the Unity canvas/layout groups. I have a series of canvases that only show one at a time (think of them as screens). Inside each canvas are components (the first one is a graph and timer, and then a data panel and some buttons.

Here is an image of what I'd like each of the panels to look like (only one of these will be open at a time):

Unity Canvas

Essentially, I just want each sub-canvas (the dark gray boxes) to inhabit ~50% x 50% of the screen, and when the orientation is horizontal/vertical, tile them accordingly.

Each Child panel (the dark gray) only needs to change. The children inside of the panel can stay and scale relative to the parent canvas.

I have tried EVERYTHING, dug through the documentation, and have run out of options.

Upvotes: 0

Views: 1497

Answers (1)

Have you tried adding a Layout Element to all of those gray panels with a Flexible Width or Height setting? The screenshot below shows how to have two panels that are side by side, both occupying half the width of their container. (Both have a Flexible Width setting of 1.)

Layout element

The two Panels are children of the Canvas that has a Horizontal Layout group like this:

Upvotes: 0

Related Questions