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 @@ static void UpdateMaskTextures() { 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 @@ static void UpdateSceneViewMatrixForShader() 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); + } } } }