I am working on a 2d project.I am using different sprites of different pixels inside my project.Each sprites are having different height and width not square sides. For example look at the sprite settings in the project.Similarly there are many sprites like this.This light green background is used as football court.It looks ok in ipad view(2732 x 2048 Portrait mode).
But if I change it to iphone6 view(750 x 1334 Potrait Mode).The sprites don't get resized.Still look big.The dark green part cannot be seen.I have added other sprites which also don't change their size.The image is given below.
I got a code of getting the screen size which is given below.
public static float GetScreenToWorldWidth
{
get
{
Vector2 topRightCorner = new Vector2(1, 1);
Vector2 edgeVector = Camera.main.ViewportToWorldPoint(topRightCorner);
var width = edgeVector.x * 2;
return width;
}
}
If I have the screen width how to make use of it to adjust the sprites to various screen resolutions.For this resolution(2732 x 2048 Portrait mode ipad pro) I need not change the sprites size.But for all other screen resolutions change accordingly.