diff --git a/Scripts/SoftMask.cs b/Scripts/SoftMask.cs index 3cfd2fd..f67c37c 100644 --- a/Scripts/SoftMask.cs +++ b/Scripts/SoftMask.cs @@ -464,9 +464,10 @@ namespace Coffee.UIExtensions // Set view and projection matrices. var c = graphic.canvas.rootCanvas; - if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && c.worldCamera) + var cam = c.worldCamera ?? Camera.main; + if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && cam) { - _cb.SetViewProjectionMatrices(c.worldCamera.worldToCameraMatrix, c.worldCamera.projectionMatrix); + _cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, cam.projectionMatrix); } else { diff --git a/Scripts/SoftMaskable.cs b/Scripts/SoftMaskable.cs index 645b187..d709b1e 100644 --- a/Scripts/SoftMaskable.cs +++ b/Scripts/SoftMaskable.cs @@ -206,9 +206,9 @@ namespace Coffee.UIExtensions Material mat = sm._maskMaterial; var c = sm.graphic.canvas.rootCanvas; - if (c.renderMode != RenderMode.ScreenSpaceOverlay && c.worldCamera) + var wcam = c.worldCamera ?? Camera.main; + if (c.renderMode != RenderMode.ScreenSpaceOverlay && wcam) { - var wcam = c.worldCamera; var pv = GL.GetGPUProjectionMatrix (wcam.projectionMatrix, false) * wcam.worldToCameraMatrix; mat.SetMatrix(s_GameVPId, pv); mat.SetMatrix(s_GameTVPId, pv);