Sprite scaling for different resolutions

Hi guys ,question,I’m quite a beginner in screen resolutions and sprite scaling so I need some help.

What does screen.SetResolution do?I’ve tested it out and I appears to scale my sprites to look the same as the resolution I developed in /put in the parameters?

Is this the correct way to scale sprites to look the same on all devices or am I doing it wrongly?if so what can/do I fix to make it scale to all resolutions perfectly and maintain its quality

I think it is a wrong way. But you can do this to transform virtually the screen size.

You can use a ContentScaler layout I think.

For my 2D Game I do this:
. create a canvas and set CanvasScaler to Scale With Screen size
. set screen match mode to Expand
. create your GUI in canvas and set layout to fit size (create an empty game object to hold UI image …)
. load HD or SD texture if needed.

If you use a 2d object sprite, I do not know well.

Since you are not using UI components, so now your in trouble for dealing with different resolutions. I have a way but not sure it is the cleaner one. Create a script called ObjectResizer and use write down this code:

public class ObjectResizer : MonoBehaviour
	public float ratioX1, ratioY1, ratioX2, ratioY2;
	public float scaleRatio1, scaleRatio2;

	// Use this for initialization
	void Start ()
		float currentScreenRatio = (float)((float)Screen.width / (float)Screen.height);
		float m, b;
		float x1, y1, x2, y2;
		x1 = ratioX1 / ratioY1;
		x2 = ratioX2 / ratioY2;		
		y1 = scaleRatio1;	
		y2 = scaleRatio2;	
		m = (y2 - y1) / (x2 - x1);

		b = y2 - (m * x2);

		transform.localScale = new Vector2 ((m * currentScreenRatio) + b, (m * currentScreenRatio) + b);

Attach this script to the game object and set the parameters like: (This is example, set it based on your criteria)

ratioX1 = 3, ratioY1 = 4, scaleRatio1 = 0.8f
ratioX2 = 9, ratioY2 = 16; scaleRatio2 = 0.7f

Here ratioX1, ratioY1 should be the values on which aspect ratio you have designed the screen and get the value say scaleRatio1 = 0.8. ratioX2, ratioY2 should be by getting it on any other resolution may 3:2 or 9:16. Adjust the image for this resolution and get the value say scaleRatio2 = 0.7.

This says that the screen is designed on 3:4 aspect ratio and by looking it at 9:16 or any other aspect ratio we can get the variation behaviour m. Once the curve evaluates, you can resize it for any resolution using transform.localScale.

Hope it helps.