From a0e32d6f66b92cec49bbae720646f8b4232ba1b7 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Sat, 15 Dec 2018 20:20:14 +0900 Subject: [PATCH] Add null check for prefab editor --- Scripts/SoftMask.cs | 5 ++++- Scripts/SoftMaskable.cs | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Scripts/SoftMask.cs b/Scripts/SoftMask.cs index 5c505d2..b88b0f8 100644 --- a/Scripts/SoftMask.cs +++ b/Scripts/SoftMask.cs @@ -340,7 +340,10 @@ namespace Coffee.UIExtensions { foreach (var sm in s_ActiveSoftMasks) { - sm.UpdateMaskTexture(); + if(sm) + { + sm.UpdateMaskTexture (); + } } } diff --git a/Scripts/SoftMaskable.cs b/Scripts/SoftMaskable.cs index 86f3793..834509d 100644 --- a/Scripts/SoftMaskable.cs +++ b/Scripts/SoftMaskable.cs @@ -158,11 +158,14 @@ namespace Coffee.UIExtensions foreach (var sm in s_ActiveSoftMaskables) { - Material mat = sm._maskMaterial; - if (mat) + if(sm) { - mat.SetMatrix("_SceneView", w2c); - mat.SetMatrix("_SceneProj", prj); + Material mat = sm._maskMaterial; + if (mat) + { + mat.SetMatrix ("_SceneView", w2c); + mat.SetMatrix ("_SceneProj", prj); + } } } }