Canvas too big for the camera in Unity

To force your Hierarchy Canvas UI to the same resolution as the Camera View in your Unity Editor Scene window resolution (i.e. not ridiculously massive), or in other words get the Canvas to fit into the Camera size in the Scene, do the following:

  1. Set the Canvas component's Render Mode to Screen Space - Camera.
  2. Make sure you select or drag the relevant Camera from the Hierarchy to the Render Camera field in the Inspector.

You should use the Unity canvas for this along with the canvas scaler component. If I'm not mistaken it will scale all elements relative to the screen they are viewed on.

The canvas scaler allows you to match the scaling based on a preferred viewport size which is a life saver.

However this may not fit you needs perfectly as it would mean that the background element would become fixed. So if you wanted to pan the element you would need to move it's x and y elements within the canvas.

Hope that helps?

Tags:

Unity3D