I changed my canvas scaler to “Constant Physical Size” and then my layout group component prefabs got scaled to 0.26…something. As soon as I return back to “Constant Pixel Size” then everything is back to normal. I have created a layout group element identical to my prefabs and it doesn’t suffer from the scaling problem. It seems only runtime prefabs are affected.
Is there something I am missing here or is this a bug? Check out the screenshot and I also attached a minimal project to demonstrate.
2156812–142473–Sandbox.zip (414 KB)
1 Like
I’m going to answer my own question here, but I am not happy with this solution. Basically I added a script that resets the scale back to 1, in Start. I feel that I am missing something here, or this is definitely a bug.
The wrong scale changes with the units that I pick (millimeters, inches, etc…), though I still don’t understand why.
I ran into into the same issue. Eventually I noticed some warnings that said:
“Parent of RectTransform is being set with parent property. Consider using the SetParent method instead, with the worldPositionStays argument set to false. This will retain local orientation and scale rather than world orientation and scale, which can prevent common UI scaling issues.”
Indeed, I switched from the property to SetParent
and it resolved the issue for me.
1 Like