Canvas scaling differently in build and Unity editor

Hello!

I’ve set my Canvas Scaler to scale with screen size and Match to 0,5. In the Unity editor and it’s play mode the canvas looks good, but once I build & run everything scales differently.

Why does that happen?

This happened to me when I was Instantiating my panels and assigning them parents using SetParent with worldPositionStays parameter to true. This caused them to try to keep their initial scale independent of the Canvas’s scale when parented, so they were being assigned a scale factor on their Rect Transform, instead of keeping the 1.0 scaling I wanted. I just set the worldPositionStays parameter to false to fix it.

I should note that I think I was seeing this in Play Mode as well, but it was harder to notice cause it was only at larger resolutions.