Distance between two screen points across different resolutions

Hello,

I’m trying to calculate the distance between two screen points. I’m using Vector2.Distance, however I’m getting inconsistent results on different resolutions (duh). I’m wondering how I can achieve a consistent result.

I’ve tried incorporating the screen ratio, Screen.width / Screen.height, but I’m either applying it incorrectly or it just isn’t needed for this.

// try 1
float distance = Vector2.Distance(mousePosOne, mousePosTwo) / screenRatio;
//try 2
float distance = Vector2.Distance(mousePosOne / screenRatio, mousePosTwo / screenRatio);

Any guidance would be appreciated!

Well, I’d still like to have an answer for the above, but I found a workaround.

I just changed the screenpoints to Viewport points via camera.ScreenToViewportPoint()