I have an issue where when the Canvas is set to Screen Space - Overlay and a Canvas Scaler is used and set to Scale Width Screen Size mode, the shader _ScreenParams appears to not be reflecting what is the correct width & height.
If I change to Screen Space - Camera and assign the main camera then everything is fine. However, if I don’t assign the main camera, the issue returns.
I would appreciate some feedback or insight on this please.
I am using _ScreenParams to compute the Pixel scale in my Shader but when a Canvas Scaler is used in Screen Space - Overlay or Screen Space - Camera and no camera is referenced, it appears the geometry is scaled internally by Unity while this scaling is not reflected in _ScreenParams. I can compensate for this by checking if a Canvas Scaler is used and if a Camera is referenced at which point I ignore the lossyScale in my computation but I then end up with a clean looking object in the GameView but potentially an object too soft or too sharp in the editor since we now have two scales.
I am just trying to figure out how I should be handling this Canvas Scaler.
I’ll ask around because i have NO idea…
I don’t understand what the problem is. _ScreenParams is documented like this:
This is unrelated to anything in the UI system.
The CanvasScaler sets the Canvas scaleFactor, which in the end just adjusts the localScale of the Canvas GameObject. There is no internal scaling other than this regular scaling of a GameObject.