1

I am trying to match the size of a grid in Unity UI Canvas with another grid which consists of sprite renderers.

The UI Cell Grid

The Sprite Renderer Grid

What I would like to do is to set the UI Grid on top of the Sprite Renderer grid. I was able to achieve this in 9:16(with my canvas scaler set at 1600-900 with 0.5 width/height match) aspect ratio with setting the UI Grid and Sprite Renderer's parent position as Vector3.zero.

However, when I change to a different aspect ratio (say 9:18) I change my Canvas Scaler in the UI Grid's canvas to 1800-900 with 0.5 width and height match for other UI purposes. After which the 2 grids dont align anymore. (Even with their position vectors set to zero). I understand there's a difference in where it is being rendered, so is there anyway I can scale my Sprite Renderer grid with respect to the UI grid?

Also, I am using 2 cameras to render the UI canvas and sprite renderer grid separately. Im assuming I have to change the orthographic size of the camera rendering the sprite renderer grid? But what is the calculation behind it?

Arvind B
  • 23
  • 1
  • 5

0 Answers0