diff --git a/Scripts/Editor/CompressionTests.cs b/Scripts/Editor/CompressionTests.cs index 9befa52..53bdfeb 100644 --- a/Scripts/Editor/CompressionTests.cs +++ b/Scripts/Editor/CompressionTests.cs @@ -146,7 +146,6 @@ public class CompressionTests { { public Vector3 myPosition; public Vector3[] myPositionHistory; - public Transform mytransform; public string[] myChatHistory; } diff --git a/Scripts/Utilities/DragCorrector.cs b/Scripts/Utilities/DragCorrector.cs new file mode 100644 index 0000000..993e663 --- /dev/null +++ b/Scripts/Utilities/DragCorrector.cs @@ -0,0 +1,31 @@ +/// Credit FireOApache +/// sourced from: http://answers.unity3d.com/questions/1149417/ui-button-onclick-sensitivity-for-high-dpi-devices.html#answer-1197307 + +/*USAGE: +Simply place the script on the EventSystem in the scene to correct the drag thresholds*/ + +using UnityEngine.EventSystems; + +namespace UnityEngine.UI.Extensions +{ + [RequireComponent(typeof(EventSystem))] + [AddComponentMenu("UI/Extensions/DragCorrector")] + public class DragCorrector : MonoBehaviour + { + public int baseTH = 6; + public int basePPI = 210; + public int dragTH = 0; + + void Start() + { + dragTH = baseTH * (int)Screen.dpi / basePPI; + + EventSystem es = GetComponent(); + + if (es) + { + es.pixelDragThreshold = dragTH; + } + } + } +} \ No newline at end of file diff --git a/Scripts/Utilities/DragCorrector.cs.meta b/Scripts/Utilities/DragCorrector.cs.meta new file mode 100644 index 0000000..a4cd134 --- /dev/null +++ b/Scripts/Utilities/DragCorrector.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: af1c809ef037025409983d19f9b0baac +timeCreated: 1464969622 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Utilities/PPIViewer.cs b/Scripts/Utilities/PPIViewer.cs new file mode 100644 index 0000000..10523db --- /dev/null +++ b/Scripts/Utilities/PPIViewer.cs @@ -0,0 +1,28 @@ +/// Credit FireOApache +/// sourced from: http://answers.unity3d.com/questions/1149417/ui-button-onclick-sensitivity-for-high-dpi-devices.html#answer-1197307 + +/*USAGE: +Simply place the script on A Text control in the scene to display the current PPI / DPI of the sceen*/ + +namespace UnityEngine.UI.Extensions +{ + [RequireComponent(typeof(Text))] + [AddComponentMenu("UI/Extensions/PPIViewer")] + public class PPIViewer : MonoBehaviour + { + private Text label; + + void Awake() + { + label = GetComponent(); + } + + void Start() + { + if (label != null) + { + label.text = "PPI: " + Screen.dpi.ToString(); + } + } + } +} \ No newline at end of file diff --git a/Scripts/Utilities/PPIViewer.cs.meta b/Scripts/Utilities/PPIViewer.cs.meta new file mode 100644 index 0000000..5a9b3ab --- /dev/null +++ b/Scripts/Utilities/PPIViewer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b0f2698294b9b524bb75cb394378eb6e +timeCreated: 1464969622 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityUIExtensions-5.3.unitypackage b/UnityUIExtensions-5.3.unitypackage index f02a2fc..51636e1 100644 Binary files a/UnityUIExtensions-5.3.unitypackage and b/UnityUIExtensions-5.3.unitypackage differ