From 82c1de9f35a2fdc1c0c8c5824785df6b331f8abe Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Tue, 28 Jan 2020 19:11:35 +0900 Subject: [PATCH] fix: Projection Matrix check always true when using world space canvas Close #67 --- .../UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs index 953cd68..cf4530d 100755 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs @@ -409,10 +409,8 @@ namespace Coffee.UIExtensions List _children = new List(); bool _hasChanged = false; bool _hasStencilStateChanged = false; -#if !UNITY_2018_1_OR_NEWER static readonly Dictionary s_previousViewProjectionMatrices = new Dictionary (); static readonly Dictionary s_nowViewProjectionMatrices = new Dictionary (); -#endif Material material { get { return _material ? _material : _material = new Material(s_SoftMaskShader ? s_SoftMaskShader : s_SoftMaskShader = Resources.Load("SoftMask")){ hideFlags = HideFlags.HideAndDontSave }; } } @@ -438,18 +436,14 @@ namespace Coffee.UIExtensions if(!cam) continue; - Matrix4x4 nowsVP = cam.projectionMatrix * cam.worldToCameraMatrix; + Matrix4x4 nowVP = cam.projectionMatrix * cam.worldToCameraMatrix; -#if UNITY_2018_1_OR_NEWER - Matrix4x4 previousVP = cam.previousViewProjectionMatrix; -#else Matrix4x4 previousVP = default(Matrix4x4); int id = cam.GetInstanceID (); s_previousViewProjectionMatrices.TryGetValue (id, out previousVP); - s_nowViewProjectionMatrices[id] = nowsVP; -#endif + s_nowViewProjectionMatrices[id] = nowVP; - if (previousVP != nowsVP) + if (previousVP != nowVP) { sm.hasChanged = true; }