Swipe Detection Best Practices

Hi everyone !

I am currently doing the inputs for my game. I need to detect horizontal and vertical swipes for the main character movements (Left / right / jump / duck).
I currently detect it using a percentage of the screen width or height.
The only issue with that is the results can vary regarding the devices.
I guess the best practice will be to detect the swipe using real physical size. That way it should not be device dependent.
Is it safe then to use the Screen.dpi property ?

And ideas / thought ?

Thanks a lot,

Personally I would buy a ready made solution from the asset store. I have bought many assets for my project and it has saved me so much coding time.

There may even be free assets that do what you need, you could look at the code and see how its done and then create your own version.