From 1bc0c8ff530226290b0bbabc24d12a8c30c08892 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Mon, 11 Mar 2019 20:30:43 +0900 Subject: [PATCH 1/2] fix #36; if canvas camera is not set in world space mode, masked contents are not displayed --- .../Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs | 5 +++-- .../UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs index 3cfd2fd..f67c37c 100644 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs @@ -464,9 +464,10 @@ void UpdateMaskTexture() // 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/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs index 645b187..d709b1e 100644 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs @@ -206,9 +206,9 @@ static void UpdateSceneViewMatrixForShader() 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); From 076c3148a38a0c822f73d8eea82ab09bcf4a8fd5 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Mon, 11 Mar 2019 20:42:29 +0900 Subject: [PATCH 2/2] update documents for v0.7.1 --- .../UIExtensions/SoftMaskForUGUI/CHANGELOG.md | 14 ++++++++++---- .../UIExtensions/SoftMaskForUGUI/package.json | 2 +- CHANGELOG.md | 14 ++++++++++---- package.json | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/CHANGELOG.md b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/CHANGELOG.md index df58b27..ced1495 100644 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/CHANGELOG.md +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [v0.7.1](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.1) (2019-03-11) + +[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.7.0...v0.7.1) + +**Fixed bugs:** + +- if canvas camera is not set in world space mode, masked contents are not displayed [\#36](https://github.com/mob-sakai/SoftMaskForUGUI/issues/36) + ## [v0.7.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.0) (2019-03-11) [Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.6.0...v0.7.0) @@ -7,8 +15,6 @@ Add 'part of parent' option to make multiple holes on one background ![](https://user-images.githubusercontent.com/12690315/54102470-f5c26e80-440b-11e9-89d1-899aa4dca00d.png) - - **Implemented enhancements:** - 'Parts of parent' option [\#29](https://github.com/mob-sakai/SoftMaskForUGUI/issues/29) @@ -22,8 +28,8 @@ Add 'part of parent' option to make multiple holes on one background [Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.5.0...v0.6.0) -![](https://user-images.githubusercontent.com/12690315/52258046-e2ca0380-2960-11e9-8cdb-46ee4a5f880f.png) -Scene view bugs have been fixed. +![](https://user-images.githubusercontent.com/12690315/52258046-e2ca0380-2960-11e9-8cdb-46ee4a5f880f.png) +Scene view bugs have been fixed. **Fixed bugs:** diff --git a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/package.json b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/package.json index 3229cac..a20eb00 100644 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/package.json +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/package.json @@ -2,7 +2,7 @@ "name": "com.coffee.softmask-for-ugui", "displayName": "Soft Mask For uGUI", "description": "SoftMask is a smooth masking component for uGUI elements in Unity.\nBy using SoftMask instead of default Mask, rounded edges of UI elements can be expressed beautifully.", - "version": "0.7.0", + "version": "0.7.1", "unity": "2017.1", "license": "MIT", "repository": { diff --git a/CHANGELOG.md b/CHANGELOG.md index df58b27..ced1495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [v0.7.1](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.1) (2019-03-11) + +[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.7.0...v0.7.1) + +**Fixed bugs:** + +- if canvas camera is not set in world space mode, masked contents are not displayed [\#36](https://github.com/mob-sakai/SoftMaskForUGUI/issues/36) + ## [v0.7.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.0) (2019-03-11) [Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.6.0...v0.7.0) @@ -7,8 +15,6 @@ Add 'part of parent' option to make multiple holes on one background ![](https://user-images.githubusercontent.com/12690315/54102470-f5c26e80-440b-11e9-89d1-899aa4dca00d.png) - - **Implemented enhancements:** - 'Parts of parent' option [\#29](https://github.com/mob-sakai/SoftMaskForUGUI/issues/29) @@ -22,8 +28,8 @@ Add 'part of parent' option to make multiple holes on one background [Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.5.0...v0.6.0) -![](https://user-images.githubusercontent.com/12690315/52258046-e2ca0380-2960-11e9-8cdb-46ee4a5f880f.png) -Scene view bugs have been fixed. +![](https://user-images.githubusercontent.com/12690315/52258046-e2ca0380-2960-11e9-8cdb-46ee4a5f880f.png) +Scene view bugs have been fixed. **Fixed bugs:** diff --git a/package.json b/package.json index 3229cac..a20eb00 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.coffee.softmask-for-ugui", "displayName": "Soft Mask For uGUI", "description": "SoftMask is a smooth masking component for uGUI elements in Unity.\nBy using SoftMask instead of default Mask, rounded edges of UI elements can be expressed beautifully.", - "version": "0.7.0", + "version": "0.7.1", "unity": "2017.1", "license": "MIT", "repository": {