Tanoda
DragCorrector.cs
Go to the documentation of this file.
1
3
4/*USAGE:
5Simply place the script on the EventSystem in the scene to correct the drag thresholds*/
6
8
10{
11 [RequireComponent(typeof(EventSystem))]
12 [AddComponentMenu("UI/Extensions/DragCorrector")]
13 public class DragCorrector : MonoBehaviour
14 {
15 public int baseTH = 6;
16 public int basePPI = 210;
17 public int dragTH = 0;
18
19 void Start()
20 {
21 dragTH = baseTH * (int)Screen.dpi / basePPI;
22
23 EventSystem es = GetComponent<EventSystem>();
24
25 if (es)
26 {
27 es.pixelDragThreshold = dragTH;
28 }
29 }
30 }
31}
Credit Erdener Gonenc - @PixelEnvision.