I have some issue with my UI when I change screen's width.

enter image description here

I have two panels, which named Left Panel and Right Panel. Each has top left/right pivot point.

Above screenshot was captured with 1280x800 size of width, and I'm using UI Scale Mode as Scale with Screen Size and reference resolution value is 1280x800, and Screen Match Mode set to Expand.

enter image description here

So it works well with 1280x800, however with lower resolution, I have some empty spaces between left and right panels:

enter image description here

What I want is keep Left panel has same width, but only changes the width of the right panel.

Unfortunately I can't find any related informations, and I tried to adjust the size by script directly but it wasn't worked as expected.

To explain what is that mean, I got the size of left panel and Screen.width, and subtracted screen from Left Panel's width.

It works in same resolution(1280x800), however in lower resolution(1024x600), it was totally wrong.

Left Panel has almost 400 width, so in this case, Right Panel should be has 880(not include spaces between panel).

So in 1024x600 resolution, it must be near by 620 (1024 - 400 = 624), and calculation was correct but results of Right Panel too small short.

To make fit Right Panel, I had to set to width almost 800, and I don't know what's going on. Just adding 400 + 800 already exceeds 1024.

I think I have to do something like dynamic resizing, to automatically resize it's width or height, but I don't get it how to work with static sized element(Left Panel).

Can anyone give me some advice to how to work my UI respond dynamically with static UI element?

Or, what did I wrong in manually setting the width of the Right Panel by script, why the panel was too short?

Any advice will very appreciate it.

  • \$\begingroup\$ This is one of those things that I know layout groups can fix (in this case, a horizontal layout group) but I have no idea how to make them work. \$\endgroup\$ – Draco18s Sep 15 '18 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.