UI Panel not covering whole screen

Hi,

So using the new UI system (4.6+), I’ve created a UI Canvas with the Render Mode set to ‘Screen Space - Overlay’ and have given it a child Panel. I’ve set the panel to be black and completely opaque (Alpha = 255). By default, the scale of the panel’s rect transform is set at 1, 1, 1. Later on the goal will be to transition the alpha value to zero to achieve a fade effect. But right now, my problem is that the panel does not cover the whole screen. I can still see little slivers on all sides of what is behind it. I’ve come up with a quick and dirty solution which is to set the scale of the panel’s x and y anchors of its Rect Transform component to 1.01. This works, but I don’t feel like it’s the right answer. Any ideas where I’m going wrong? Many thanks in advance :slight_smile:

3 Answers

3

First, make sure the CanvasScaler component on the Canvas has the “UI Scale Mode” set to “Scale with Screen Size”, “Screen Match Mode” set to “Match Width or Height” and the Match slider set all the way to the smallest axis (if the resolutions is set to 800x600, set the slider to 1). This will make the canvas to be almost always as big as the whole screen, respecting the aspect ratio.

Next, select the Panel, look at the Image component. Set the Source Image to “none”. This will paint the canvas as a full rectangle of one color. Now in the Rect Transform set the anchor mode to stretch in both directions, and set Left, Right, Bottom and Top to 0. Reset the scale to 1,1,1.

This should do it.

thanks, setting the image of pannel to 'None' fix that.

–

I can't tell you how many times this post has helped me out. Thank you!

–

Thanks Diego, setting the Source Image to ‘None’ in the image component of the panel is what fixed it for me. :slight_smile:

Same here - it was default image that has some pixels removed.