title: Can I change a World Space canvas width to match screen?
body: <p>I have a Unity2D orthographic projection game laid out on a World Space canvas. When I change aspect ratios, the UI elements get clipped off by the screen edges. I understand I could Screen Space to solve that, but that causes other issues. I need this canvas to be in World Space.</p>
  
  <p>The attached image shows the layout in 18:9 in the Scene window. I changed the aspect to 4:3 in the Game window, then went back to the Scene window. You can see how the canvas will be clipped to 4:3. If I resize the canvas width to match the screen aspect everything is fine, but I need to do that in script to match the device aspect ratio, not just through the Inspector.</p>
  
  <p>It looks like I can resize the canvas to match the 4:3 screen and all is well, but how do I do that in code?</p>
  
  <p><a href="https://i.stack.imgur.com/r4QLO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r4QLO.jpg" alt="enter image description here"></a></p>