unity – Panel gets transparent when accessing the offsetMin of RectTransform

I need to place 3 panels side by side in my application. It was working fine with Render mode Screen space - Overlay. Now due to some other requirement, I had to change the Render mode to Screen space - Camera. Now when I access the offsetMin of RectTransform of the panels so that it shifts to the right, the panel gets transparent.

I commented the code where I’m accessing and the Panel doesnt get transparent then.

I’m not sure why it is happening.

The requirement is place a 3D model in canvas, so I had to change the Render mode. If there is a way to place 3D model in canvas with Screen space - Overlay. That would be great as well.