├── .gitignore ├── Samples~ ├── Demo │ ├── Light_Frame.png │ ├── Unity-chan.png │ ├── UITransition_Art.png │ ├── Unmask_Demo.unity.meta │ ├── Unmask_Demo.asmdef.meta │ ├── Unmask_Demo.controller.meta │ ├── Unmask_Demo_Button.controller.meta │ ├── Unmask_Demo.cs.meta │ ├── Unmask_Demo.asmdef │ ├── Unmask_Demo.cs │ ├── Unity-chan.png.meta │ ├── Light_Frame.png.meta │ ├── UITransition_Art.png.meta │ ├── Unmask_Demo_Button.controller │ └── Unmask_Demo.controller └── Demo.meta ├── .npmignore ├── Scripts ├── Coffee.UnmaskForUGUI.asmdef ├── Editor.meta ├── Coffee.UnmaskForUGUI.asmdef.meta ├── Editor │ ├── Coffee.UnmaskForUGUI.Editor.asmdef.meta │ ├── MenuOptions.cs.meta │ ├── ImportSampleMenu.cs.meta │ ├── Coffee.UnmaskForUGUI.Editor.asmdef │ ├── ImportSampleMenu.cs │ └── MenuOptions.cs ├── Unmask.cs.meta ├── UnmaskRaycastFilter.cs.meta ├── UnmaskRaycastFilter.cs └── Unmask.cs ├── CONTRIBUTING.md.meta ├── CODE_OF_CONDUCT.md.meta ├── CHANGELOG.md.meta ├── README.md.meta ├── LICENSE.md.meta ├── package.json.meta ├── Scripts.meta ├── .github ├── ISSUE_TEMPLATE │ ├── question.md │ ├── feature_request.md │ └── bug_report.md ├── workflows │ ├── release.yml │ └── test.yml └── FUNDING.yml ├── .releaserc.json ├── package.json ├── LICENSE.md ├── CONTRIBUTING.md ├── CODE_OF_CONDUCT.md ├── CHANGELOG.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Thumbs.db 2 | Desktop.ini 3 | .DS_Store 4 | 5 | !Samples~ 6 | 7 | *.tgz 8 | *.tgz.meta 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Light_Frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/UnmaskForUGUI/HEAD/Samples~/Demo/Light_Frame.png -------------------------------------------------------------------------------- /Samples~/Demo/Unity-chan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/UnmaskForUGUI/HEAD/Samples~/Demo/Unity-chan.png -------------------------------------------------------------------------------- /Samples~/Demo/UITransition_Art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mob-sakai/UnmaskForUGUI/HEAD/Samples~/Demo/UITransition_Art.png -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | Thumbs.db 2 | Desktop.ini 3 | .DS_Store 4 | 5 | !Samples~ 6 | Samples.meta 7 | 8 | *.tgz 9 | *.tgz.meta 10 | .releaserc.json 11 | .github 12 | -------------------------------------------------------------------------------- /Scripts/Coffee.UnmaskForUGUI.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Coffee.UnmaskForUGUI", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [] 6 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b85675b2587cd4b2e919c33d7913131f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbddc129164884a2ba83385fd1abb547 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbca627d531eb4ca9b5846c638709e4c 3 | timeCreated: 1539214410 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c5f8a1ac798e442eb3c77b05470878d 3 | timeCreated: 1539214410 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b39bece0bad6e409da07817e7f8bf0ab 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Unmask_Demo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32ce32a82c95d44f28b601b63832814f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e643812cd08a4453699dfb822174293d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cefd86cfe94614a08ac447d0a9ec6ad3 3 | timeCreated: 1539214411 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 011faffdd04c64066883bc8402a48942 3 | timeCreated: 1548415750 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Unmask_Demo.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acd12bb8ab04d49bda545268e0943c1d 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Scripts/Coffee.UnmaskForUGUI.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ef573751495a4f88822a98a88954a0b 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Scripts/Editor/Coffee.UnmaskForUGUI.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ffa5e7486ed1842bc83e3e28c764641b 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Unmask_Demo.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a0c211e2368a4ccb99a4f99bb3195ab 3 | timeCreated: 1539248707 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50a872063d2754fcd9d092eab7677003 3 | folderAsset: yes 4 | timeCreated: 1539214485 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Samples~/Demo/Unmask_Demo_Button.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb134c10bcf4344b6812e6dc0d970dd1 3 | timeCreated: 1539248707 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Scripts/Unmask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f752d3a51152f4e44a3ebe45ae24abcc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/Editor/MenuOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc59618a242c64b8f8063cd038562232 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/Editor/ImportSampleMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c85dfe3e8c67c49c3ba7d8c035da69bf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/UnmaskRaycastFilter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0bb9714b62a114d45b65f30fc946ea5c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Unmask_Demo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab46b16b64e214e0d91583c53ac12da4 3 | timeCreated: 1539491659 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Samples~/Demo/Unmask_Demo.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unmask_Demo", 3 | "references": [ 4 | "Coffee.UnmaskForUGUI" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask a question about this project 4 | title: '' 5 | labels: question 6 | assignees: mob-sakai 7 | 8 | --- 9 | 10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one. 11 | 12 | **Describe what help do you need** 13 | A description of the question. 14 | 15 | **Additional context** 16 | Add any other context or screenshots about the question here. 17 | -------------------------------------------------------------------------------- /Scripts/Editor/Coffee.UnmaskForUGUI.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Coffee.UnmaskForUGUI.Editor", 3 | "references": [ 4 | "Coffee.UnmaskForUGUI" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": false, 15 | "defineConstraints": [] 16 | } -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | branches: 6 | - preview 7 | - main 8 | - v*.x 9 | tags-ignore: 10 | - "**" 11 | 12 | jobs: 13 | release: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | - uses: cycjimmy/semantic-release-action@v3 19 | with: 20 | extra_plugins: | 21 | @semantic-release/changelog 22 | @semantic-release/git 23 | env: 24 | GITHUB_TOKEN: ${{ github.token }} 25 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "branches": [ 3 | "+([0-9])?(.{+([0-9]),x}).x", 4 | "master", 5 | "main", 6 | { 7 | "name": "preview", 8 | "prerelease": true 9 | } 10 | ], 11 | "tagFormat": "${version}", 12 | "plugins": [ 13 | "@semantic-release/commit-analyzer", 14 | "@semantic-release/release-notes-generator", 15 | "@semantic-release/changelog", 16 | [ 17 | "@semantic-release/npm", 18 | { 19 | "npmPublish": false 20 | } 21 | ], 22 | "@semantic-release/git", 23 | "@semantic-release/github" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.coffee.unmask", 3 | "displayName": "UI Unmask", 4 | "description": "Reverse mask for uGUI element in Unity.", 5 | "version": "1.4.2", 6 | "unity": "2017.1", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/mob-sakai/UnmaskForUGUI.git" 11 | }, 12 | "author": "mob-sakai (https://github.com/mob-sakai)", 13 | "dependencies": {}, 14 | "keywords": [ 15 | "ui", 16 | "mask" 17 | ], 18 | "samples": [ 19 | { 20 | "displayName": "Demo", 21 | "description": "UI Unmask Demo", 22 | "path": "Samples~/Demo" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: mob-sakai # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: mob_sakai # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: mob-sakai 7 | 8 | --- 9 | 10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one. 11 | 12 | **Is your feature request related to a problem? Please describe.** 13 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 14 | 15 | **Describe the solution you'd like** 16 | A clear and concise description of what you want to happen. 17 | 18 | **Describe alternatives you've considered** 19 | A clear and concise description of any alternative solutions or features you've considered. 20 | 21 | **Additional context** 22 | Add any other context or screenshots about the feature request here. 23 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2018 mob-sakai 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: mob-sakai 7 | 8 | --- 9 | 10 | NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one. 11 | 12 | **Describe the bug** 13 | A clear and concise description of what the bug is. 14 | 15 | **To Reproduce** 16 | Steps to reproduce the behavior: 17 | 1. Go to '...' 18 | 2. Click on '....' 19 | 3. Scroll down to '....' 20 | 4. See error 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots** 26 | If applicable, add screenshots to help explain your problem. 27 | 28 | **Environment (please complete the following information):** 29 | - Version [e.g. 1.0.0] 30 | - Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL] 31 | - Unity version: [e.g. 2018.2.8f1] 32 | - Build options: [e.g. IL2CPP, .Net 4.x, LWRP] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## How to Contribute 4 | 5 | #### Code of Conduct 6 | 7 | This repository has adopted the Contributor Covenant as it's 8 | Code of Conduct. It is expected that participants adhere to it. 9 | 10 | #### Proposing a Change 11 | 12 | If you are unsure about whether or not a change is desired, 13 | you can create an issue. This is useful because it creates 14 | the possibility for a discussion that's visible to everyone. 15 | 16 | When fixing a bug it is fine to submit a pull request right away. 17 | 18 | #### Sending a Pull Request 19 | 20 | Steps to be performed to submit a pull request: 21 | 22 | 1. Fork the repository and create your branch from `develop`. 23 | 2. If you have fixed a bug or added code that should be tested, add tests. 24 | 3. Click `Window > Generals > Test Runner` to test 25 | 4. Commit with a massage based on [Angular Commit Message Conventions](https://gist.github.com/stephenparish/9941e89d80e2bc58a153). 26 | 5. Fill out the description, link any related issues and submit your pull request. 27 | 28 | #### License 29 | 30 | By contributing to this repository, you agree that your contributions will be licensed under its MIT license. 31 | -------------------------------------------------------------------------------- /Samples~/Demo/Unmask_Demo.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Coffee.UIExtensions.Demos 5 | { 6 | public class Unmask_Demo : MonoBehaviour 7 | { 8 | [SerializeField] Unmask unmask = null; 9 | [SerializeField] Unmask[] smoothingUnmasks = new Unmask[0]; 10 | [SerializeField] Graphic transition = null; 11 | [SerializeField] Image transitionImage = null; 12 | [SerializeField] Sprite unity_chan = null; 13 | [SerializeField] Sprite unity_frame = null; 14 | 15 | public void AutoFitToButton(bool flag) 16 | { 17 | unmask.fitOnLateUpdate = flag; 18 | } 19 | 20 | public void SetTransitionColor(bool flag) 21 | { 22 | transition.color = flag ? Color.white : Color.black; 23 | } 24 | 25 | public void SetTransitionImage(bool flag) 26 | { 27 | transitionImage.sprite = flag ? unity_chan : unity_frame; 28 | transitionImage.SetNativeSize(); 29 | var size = transitionImage.rectTransform.rect.size; 30 | transitionImage.rectTransform.sizeDelta = new Vector2(150, size.y / size.x * 150); 31 | } 32 | 33 | public void EnableSmoothing(bool flag) 34 | { 35 | foreach (var unmask in smoothingUnmasks) 36 | { 37 | unmask.edgeSmoothing = flag ? 1 : 0; 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Scripts/UnmaskRaycastFilter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Coffee.UIExtensions 4 | { 5 | /// 6 | /// Unmask Raycast Filter. 7 | /// The ray passes through the unmasked rectangle. 8 | /// 9 | [AddComponentMenu("UI/Unmask/UnmaskRaycastFilter", 2)] 10 | public class UnmaskRaycastFilter : MonoBehaviour, ICanvasRaycastFilter 11 | { 12 | //################################ 13 | // Serialize Members. 14 | //################################ 15 | [Tooltip("Target unmask component. The ray passes through the unmasked rectangle.")] 16 | [SerializeField] private Unmask m_TargetUnmask; 17 | 18 | 19 | //################################ 20 | // Public Members. 21 | //################################ 22 | /// 23 | /// Target unmask component. Ray through the unmasked rectangle. 24 | /// 25 | public Unmask targetUnmask { get { return m_TargetUnmask; } set { m_TargetUnmask = value; } } 26 | 27 | /// 28 | /// Given a point and a camera is the raycast valid. 29 | /// 30 | /// Valid. 31 | /// Screen position. 32 | /// Raycast camera. 33 | public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) 34 | { 35 | // Skip if deactived. 36 | if (!isActiveAndEnabled || !m_TargetUnmask || !m_TargetUnmask.isActiveAndEnabled) 37 | { 38 | return true; 39 | } 40 | 41 | // check inside 42 | if (eventCamera) 43 | { 44 | return !RectTransformUtility.RectangleContainsScreenPoint((m_TargetUnmask.transform as RectTransform), sp, eventCamera); 45 | } 46 | else 47 | { 48 | return !RectTransformUtility.RectangleContainsScreenPoint((m_TargetUnmask.transform as RectTransform), sp); 49 | } 50 | } 51 | 52 | 53 | //################################ 54 | // Private Members. 55 | //################################ 56 | 57 | /// 58 | /// This function is called when the object becomes enabled and active. 59 | /// 60 | void OnEnable() 61 | { 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # Secrets 2 | # UNITY_LICENSE: 3 | name: test 4 | 5 | on: 6 | push: 7 | branches: 8 | - develop 9 | tags: 10 | - "!*" 11 | pull_request: 12 | types: 13 | - opened 14 | - synchronize 15 | 16 | jobs: 17 | unity-test: 18 | runs-on: ubuntu-latest 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | unityVersion: [ 23 | "2018.3.14f1", 24 | "2018.4.30f1", 25 | "2019.1.14f1", 26 | "2019.2.21f1", 27 | "2019.3.15f1", 28 | "2019.4.16f1", 29 | "2020.1.17f1", 30 | "2020.2.1f1", 31 | ] 32 | 33 | steps: 34 | # Checkout sandbox project 35 | - uses: actions/checkout@v4 36 | with: 37 | ref: sandbox 38 | submodules: true 39 | fetch-depth: 0 40 | 41 | # Update package submodule 42 | - name: "Update package submodule" 43 | working-directory: Packages/dev 44 | run: git checkout ${{ github.sha }} 45 | 46 | - uses: actions/cache@v3 47 | with: 48 | path: Library 49 | key: Library-${{ matrix.unityVersion }}-${{ github.sha }} 50 | restore-keys: | 51 | Library-${{ matrix.unityVersion }}- 52 | Library- 53 | 54 | # Install codecoverage package 55 | # - name: "Install codecoverage package" 56 | # if: startsWith(matrix.unityVersion, '2019.4.') 57 | # run: | 58 | # npx openupm-cli add -f com.unity.testtools.codecoverage@0.4.0-preview 59 | 60 | # Run tests 61 | - name: "Run tests" 62 | uses: game-ci/unity-test-runner@v3 63 | with: 64 | unityVersion: ${{ matrix.unityVersion }} 65 | customParameters: -nographics 66 | env: 67 | UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} 68 | 69 | # - uses: actions/upload-artifact@v2 70 | # if: always() 71 | # with: 72 | # name: TestResults-${{ matrix.unityVersion }} 73 | # path: | 74 | # artifacts/*.xml 75 | # CodeCoverage/**/TestCoverageResults_*.xml 76 | 77 | # publish: 78 | # needs: unity-test 79 | # runs-on: ubuntu-latest 80 | # if: always() 81 | # steps: 82 | 83 | # - uses: actions/download-artifact@v2 84 | # with: 85 | # path: artifacts 86 | 87 | # - uses: testspace-com/setup-testspace@v1 88 | # with: 89 | # domain: ${{github.repository_owner}} 90 | 91 | # - name: Push test results 92 | # if: always() 93 | # run: | 94 | # testspace `find . -name '*.xml' | tr '\n' ' '` -------------------------------------------------------------------------------- /Scripts/Editor/ImportSampleMenu.cs: -------------------------------------------------------------------------------- 1 | #if !UNITY_2019_1_OR_NEWER 2 | using System.IO; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using UnityEditor; 6 | 7 | namespace Coffee.UIExtensions.Editors 8 | { 9 | internal static class ImportSampleMenu_UIUnmask 10 | { 11 | private const string k_DisplayName = "UI Unmask"; 12 | private const string k_JsonGuid = "011faffdd04c64066883bc8402a48942"; 13 | 14 | [MenuItem("Assets/Samples/" + k_DisplayName + "/Import Demo")] 15 | private static void ImportDemo() 16 | { 17 | ImportSample(k_JsonGuid, "Demo"); 18 | } 19 | 20 | private static void ImportSample(string jsonGuid, string sampleName) 21 | { 22 | var jsonPath = AssetDatabase.GUIDToAssetPath(jsonGuid); 23 | var packageRoot = Path.GetDirectoryName(jsonPath).Replace('\\', '/'); 24 | var json = File.ReadAllText(jsonPath); 25 | var version = Regex.Match(json, "\"version\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value; 26 | var src = string.Format("{0}/Samples~/{1}", packageRoot, sampleName); 27 | var dst = string.Format("Assets/Samples/{0}/{1}/{2}", k_DisplayName, version, sampleName); 28 | var previousPath = GetPreviousSamplePath(k_DisplayName, sampleName); 29 | 30 | // Remove the previous sample directory. 31 | if (!string.IsNullOrEmpty(previousPath)) 32 | { 33 | var msg = "A different version of the sample is already imported at\n\n" 34 | + previousPath 35 | + "\n\nIt will be deleted when you update. Are you sure you want to continue?"; 36 | if (!EditorUtility.DisplayDialog("Sample Importer", msg, "OK", "Cancel")) 37 | return; 38 | 39 | FileUtil.DeleteFileOrDirectory(previousPath); 40 | 41 | var metaFile = previousPath + ".meta"; 42 | if (File.Exists(metaFile)) 43 | FileUtil.DeleteFileOrDirectory(metaFile); 44 | } 45 | 46 | if (!Directory.Exists(dst)) 47 | FileUtil.DeleteFileOrDirectory(dst); 48 | 49 | var dstDir = Path.GetDirectoryName(dst); 50 | if (!Directory.Exists(dstDir)) 51 | Directory.CreateDirectory(dstDir); 52 | 53 | if (Directory.Exists(src)) 54 | FileUtil.CopyFileOrDirectory(src, dst); 55 | else 56 | throw new DirectoryNotFoundException(src); 57 | 58 | AssetDatabase.Refresh(ImportAssetOptions.ImportRecursive); 59 | } 60 | 61 | private static string GetPreviousSamplePath(string displayName, string sampleName) 62 | { 63 | var sampleRoot = string.Format("Assets/Samples/{0}", displayName); 64 | var sampleRootInfo = new DirectoryInfo(sampleRoot); 65 | if (!sampleRootInfo.Exists) return null; 66 | 67 | return sampleRootInfo.GetDirectories() 68 | .Select(versionDir => Path.Combine(versionDir.ToString(), sampleName)) 69 | .FirstOrDefault(Directory.Exists); 70 | } 71 | } 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /Scripts/Editor/MenuOptions.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace Coffee.UIExtensions.Editors 6 | { 7 | internal class MenuOptions_UIUnmask 8 | { 9 | [MenuItem("GameObject/UI/Unmask/Tutorial Button")] 10 | private static void CreateTutorialButton2(MenuCommand menuCommand) 11 | { 12 | #if UNITY_2021_2_OR_NEWER 13 | const string menuItemName = "GameObject/UI/Legacy/Button"; 14 | #else 15 | const string menuItemName = "GameObject/UI/Button"; 16 | #endif 17 | EditorApplication.ExecuteMenuItem(menuItemName); 18 | var button = Selection.activeGameObject.GetComponent