Check out the image. I’ve got a panel w/ a scroll bar masking a 2nd (Red) panel that contains a list of buttons. The masking and scrolling work fine. However, the red panel doesn’t get bigger or smaller when I resize the window. (the black panel does).
You can see how I have the red panel anchored to the outside of the first (masked) panel. Is there a way to ensure the red panel resizes itself as the window grows/shrinks?
From the look of your screenshot it looks like it should resize. We’ll need more info if we are to figure out why it doesn’t.
I suggest recording a screencast (with Jing or similar) where you show the entire Editor window and show what happens (or doesn’t happen) when the parent is resized, and show the component in the Inspector of the child that is supposed to resize.
Alright I had to remove and re-do the panel & buttons, and that seems to work. Perhaps there was a bug in the first place that kept things from working properly in the end. They all resize when the window resizes, but when the aspect ratio changes, they get squished etc. I’ll keep playing and post a video if I can’t figure it out.
Here’s a video of the current problem. First the panel seems to start pink. This happens each time I leave unity and come back into it. Usually undoing until it switches back, then redoing anything that I just undid fixes it. But without fixing it, they stay pink. They were pink when I saved it last night, so maybe that’s why they didn’t show up this morning.
However the video shows the screen aspect ratio and size changing,a nd the buttons changing their aspect ratio with it.
It’s not clear to me what setup you’re using for the buttons.
If you’re using a HorizontalLayoutGroup: You probably need to add LayoutElements to the items in the group and disable Flexible Width and Flexible Height.
If you’re not using layout groups: You should probably anchor all the elements to e.g. the upper right corner and not set them to stretch, since the anchor-based stretching works independently on the horizontal and vertical axis and thus won’t preserve aspect ratio.
You can use a ReferenceResolution component on the Canvas if you want to scale everything up or down together with the screen while still preserving aspect ratio.
There’s no built-in way to make individual elements only scale with the parent size while maintaining a fixed aspect ratio.
(I can’t comment on the elements being pink, though maybe someone else on our team will be able to.)
I guess when I see it again I’ll submit something. Every time I Get stuck I just change things around in order to get around it, so I don’t have the same setup as I did a couple days ago