how to scale an object to fit the camera view

i’m trying to do invisible walls, i want the walls to be scaled with the ascept ratio of the phone.

Use Anchors:

https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html