Categories
Game Creation Mastering Development

World coordinates on vertical grid game for different aspect ratios (Unity)

new to game development and unity so hopefully someone can help.

I want to make a 2D portrait mobile game that will have a grid of constant size where units can move on in Unity.

This should support different aspect ratios. To do that I was thinking to cut sections at the top and bottom of the screen for smaller aspect ratios.

Additionally, I would like the coordinate system to be natural to the grid, so coordinate (0,0) would be the bottom left tile in the grid, (1,0) would be the tile to the right of that,… To illustrate this concept I drew something quickly:

I tried with a script that resizes the size of the orthographic camera to fit the content horizontally. Problem I had with that is that I couldn’t get a good coordinate system on the grid after the camera gets resized depending on the aspect ratio since the number of horizontal world units varies depending on the aspect ratio.

Any thoughts on what would be the best way to do this? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *