firstTouchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
endTouchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
//the height of the background(previously scaled to fit the screen) / 10
minSlidedDistance = (int)(SpriteRend.bounds.size.y / 10);
if (Vector2.Distance(firstTouchPos, endTouchPos) > minSlidedDistance)
{
//do smth
}
This way I check if the player has slided into any direction with a slided distance longer than minSlidedDistance. It works perfectly for different size devices.
Is unity going to make the calculations itself if I simply write minSlidedDistance = 100? I.e. is it still going to work same way on all devices?
P.S. this is not the full code, there are many other IF checks, like the ones for assigning the value to firstTouchPos & endTouchPos