From 85887249009c48fe21841b5cad711e207737058f Mon Sep 17 00:00:00 2001 From: Jodok Huber <jodok.huber@artfabrik.at> Date: Fri, 15 Nov 2019 14:47:29 +0100 Subject: [PATCH] fixed #52 where click events were not detected due to the y axis beeing inverted on some graphics apis --- .../UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs index c35b4fa..fdca4b9 100755 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs @@ -259,7 +259,16 @@ namespace Coffee.UIExtensions } int x = (int)((softMaskBuffer.width - 1) * Mathf.Clamp01(sp.x / Screen.width)); - int y = (int)((softMaskBuffer.height - 1) * Mathf.Clamp01(sp.y / Screen.height)); + int y = (int)((softMaskBuffer.height - 1) * (Mathf.Clamp01(sp.y / Screen.height))); + + if ((SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11) || + (SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4) || + (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan) || + (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Switch)) + { + y = (int)((softMaskBuffer.height - 1) * (1 - Mathf.Clamp01(sp.y / Screen.height))); + } + return 0.5f < GetPixelValue(x, y, interactions); }