diff --git a/CHANGELOG.md b/CHANGELOG.md index 91b04c4..fd5eda4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +# [1.0.0-preview.1](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11) + + +### Bug Fixes + +* Unintentional material destruction ([ab71747](https://github.com/mob-sakai/SoftMaskForUGUI/commit/ab7174773bb16a3b3c29e1bf9e34c0bd6d71b229)) + + +### change + +* change namespace ([ad59523](https://github.com/mob-sakai/SoftMaskForUGUI/commit/ad59523369ca7dd5d273de37f464b932246794fa)) + + +### Features + +* support graphic connector ([bd1ac08](https://github.com/mob-sakai/SoftMaskForUGUI/commit/bd1ac08f422eb2b47f3fe0d39e0d8dc13ea0a318)), closes [#75](https://github.com/mob-sakai/SoftMaskForUGUI/issues/75) [#76](https://github.com/mob-sakai/SoftMaskForUGUI/issues/76) [#80](https://github.com/mob-sakai/SoftMaskForUGUI/issues/80) + + +### BREAKING CHANGES + +* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from `Coffee.UIExtensions` to `Coffee.UISoftMask`. +* The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README. + # [0.10.0-preview.3](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.10.0-preview.2...v0.10.0-preview.3) (2020-05-08) diff --git a/README.md b/README.md index 1858a06..2bd0df9 100644 --- a/README.md +++ b/README.md @@ -155,8 +155,20 @@ Or, add a SoftMaskable components from the inspector of the SoftMask component.



## Support soft masks with your custom shaders -With just three additional lines, you can now support softmasks in your custom shaders! +Only a few steps are needed to support soft mask in your custom shaders! +1. Duplicate your shader file and add the ` (SoftMaskable)` suffix to the file name. +``` +Your_Custom_Shader.shader +-> Your_Custom_Shader (SoftMaskable).shader +``` +1. Modify the shader name (defined at the beginning of the shader file) as follows: + - Add `Hidden/` prefix + - Add ` (SoftMaskable)` suffix +``` +Shader "UI/Your_Custom_Shader" +-> Shader "Hidden/UI/Your_Custom_Shader (SoftMaskable)" +``` 1. Add `#pragma` and `#include` directives, where `SOFTMASK_EDITOR` is an editor-only keyword and is not included in the build. If you didn't use package manager to install, include `SoftMask.cginc` in the appropriate path instead. ``` diff --git a/Samples~/Demo/Light_Frame.png.meta b/Samples~/Demo/Light_Frame.png.meta index e6b51b0..571aeeb 100644 --- a/Samples~/Demo/Light_Frame.png.meta +++ b/Samples~/Demo/Light_Frame.png.meta @@ -1,10 +1,9 @@ fileFormatVersion: 2 guid: 3ad57d818b4f448a190e524e494130b0 -timeCreated: 1539763439 -licenseType: Pro TextureImporter: fileIDToRecycleName: {} - serializedVersion: 4 + externalObjects: {} + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -12,6 +11,8 @@ TextureImporter: linearTexture: 0 fadeOut: 0 borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: @@ -20,6 +21,8 @@ TextureImporter: heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -27,10 +30,13 @@ TextureImporter: textureFormat: 1 maxTextureSize: 2048 textureSettings: + serializedVersion: 2 filterMode: -1 aniso: 16 - mipBias: -1 - wrapMode: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 nPOTScale: 0 lightmap: 0 compressionQuality: 50 @@ -39,62 +45,88 @@ TextureImporter: spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 8 textureShape: 1 + singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - buildTarget: DefaultTexturePlatform + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Standalone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: iPhone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Android + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: WebGL + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] + physicsShape: [] + bones: [] + spriteID: 1a57a60f7f37742a2bb34df8b6da51de + vertices: [] + indices: + edges: [] + weights: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Samples~/Demo/SoftMask-Circle.png.meta b/Samples~/Demo/SoftMask-Circle.png.meta index 0beb757..2d9ef59 100644 --- a/Samples~/Demo/SoftMask-Circle.png.meta +++ b/Samples~/Demo/SoftMask-Circle.png.meta @@ -3,7 +3,7 @@ guid: dee1cb6c2ee294c6087ea9d89d368417 TextureImporter: fileIDToRecycleName: {} externalObjects: {} - serializedVersion: 4 + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 0 @@ -21,6 +21,8 @@ TextureImporter: heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -31,7 +33,7 @@ TextureImporter: serializedVersion: 2 filterMode: 1 aniso: -1 - mipBias: -1 + mipBias: -100 wrapU: 1 wrapV: 1 wrapW: -1 @@ -51,11 +53,13 @@ TextureImporter: spriteTessellationDetail: -1 textureType: 8 textureShape: 1 + singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - buildTarget: DefaultTexturePlatform + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 @@ -65,7 +69,8 @@ TextureImporter: allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 - - buildTarget: Standalone + - serializedVersion: 2 + buildTarget: Standalone maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 @@ -75,7 +80,8 @@ TextureImporter: allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 - - buildTarget: iPhone + - serializedVersion: 2 + buildTarget: iPhone maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 @@ -85,7 +91,8 @@ TextureImporter: allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 - - buildTarget: Android + - serializedVersion: 2 + buildTarget: Android maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 @@ -95,7 +102,8 @@ TextureImporter: allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 - - buildTarget: WebGL + - serializedVersion: 2 + buildTarget: WebGL maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 @@ -110,7 +118,15 @@ TextureImporter: sprites: [] outline: [] physicsShape: [] + bones: [] + spriteID: 2775f4bfe28684615aa97cccf30fd220 + vertices: [] + indices: + edges: [] + weights: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Samples~/Demo/SoftMask-Horizontal.png.meta b/Samples~/Demo/SoftMask-Horizontal.png.meta index 715b93b..72808bc 100644 --- a/Samples~/Demo/SoftMask-Horizontal.png.meta +++ b/Samples~/Demo/SoftMask-Horizontal.png.meta @@ -1,10 +1,9 @@ fileFormatVersion: 2 guid: f3749669408984358921fc148ed3aa83 -timeCreated: 1542628474 -licenseType: Pro TextureImporter: fileIDToRecycleName: {} - serializedVersion: 4 + externalObjects: {} + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 0 @@ -22,6 +21,8 @@ TextureImporter: heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -32,7 +33,7 @@ TextureImporter: serializedVersion: 2 filterMode: -1 aniso: -1 - mipBias: -1 + mipBias: -100 wrapU: 1 wrapV: 1 wrapW: -1 @@ -44,63 +45,88 @@ TextureImporter: spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 31, y: 0, z: 31, w: 0} spritePixelsToUnits: 100 + spriteBorder: {x: 31, y: 0, z: 31, w: 0} + spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 8 textureShape: 1 + singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - buildTarget: DefaultTexturePlatform + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Standalone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: iPhone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Android + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: WebGL + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] physicsShape: [] + bones: [] + spriteID: af5cd8d820f234217a321d94198ab089 + vertices: [] + indices: + edges: [] + weights: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Samples~/Demo/SoftMask-Star.png.meta b/Samples~/Demo/SoftMask-Star.png.meta index fbfaf14..ea1b06c 100644 --- a/Samples~/Demo/SoftMask-Star.png.meta +++ b/Samples~/Demo/SoftMask-Star.png.meta @@ -1,10 +1,9 @@ fileFormatVersion: 2 guid: 801e306fcae92475592a6d3511bf58d7 -timeCreated: 1540708816 -licenseType: Pro TextureImporter: fileIDToRecycleName: {} - serializedVersion: 4 + externalObjects: {} + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 0 @@ -22,6 +21,8 @@ TextureImporter: heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -32,7 +33,7 @@ TextureImporter: serializedVersion: 2 filterMode: 1 aniso: -1 - mipBias: -1 + mipBias: -100 wrapU: 1 wrapV: 1 wrapW: -1 @@ -44,63 +45,88 @@ TextureImporter: spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 8 textureShape: 1 + singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - buildTarget: DefaultTexturePlatform + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Standalone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: iPhone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Android + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: WebGL + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] physicsShape: [] + bones: [] + spriteID: 8058b3f596fe543db9d4d736085b08b5 + vertices: [] + indices: + edges: [] + weights: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Samples~/Demo/SoftMask-Vertictal.png.meta b/Samples~/Demo/SoftMask-Vertictal.png.meta index a319e1a..41e87a1 100644 --- a/Samples~/Demo/SoftMask-Vertictal.png.meta +++ b/Samples~/Demo/SoftMask-Vertictal.png.meta @@ -1,10 +1,9 @@ fileFormatVersion: 2 guid: 0f125745ff7d640519fb2300ed8a96c7 -timeCreated: 1542628487 -licenseType: Pro TextureImporter: fileIDToRecycleName: {} - serializedVersion: 4 + externalObjects: {} + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 0 @@ -22,6 +21,8 @@ TextureImporter: heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -32,7 +33,7 @@ TextureImporter: serializedVersion: 2 filterMode: -1 aniso: -1 - mipBias: -1 + mipBias: -100 wrapU: 1 wrapV: 1 wrapW: -1 @@ -44,63 +45,88 @@ TextureImporter: spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 31, z: 0, w: 31} spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 31, z: 0, w: 31} + spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 8 textureShape: 1 + singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - buildTarget: DefaultTexturePlatform + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Standalone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: iPhone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Android + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: WebGL + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] physicsShape: [] + bones: [] + spriteID: cf7ce3728c4c646cf88a7a642c89aa74 + vertices: [] + indices: + edges: [] + weights: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Samples~/Demo/SoftMask_Demo.cs b/Samples~/Demo/SoftMask_Demo.cs index 1bf7c9c..d110938 100644 --- a/Samples~/Demo/SoftMask_Demo.cs +++ b/Samples~/Demo/SoftMask_Demo.cs @@ -3,61 +3,57 @@ using UnityEngine; using UnityEngine.UI; -namespace Coffee.UIExtensions.Demos +namespace Coffee.UISoftMask.Demos { - public class SoftMask_Demo : MonoBehaviour - { - [SerializeField] RawImage[] softMaskBufferViewer; - [SerializeField] SoftMask[] softMask; - [SerializeField] Text text; + public class SoftMask_Demo : MonoBehaviour + { + [SerializeField] RawImage[] softMaskBufferViewer; + [SerializeField] SoftMask[] softMask; + [SerializeField] Text text; + [SerializeField] GameObject title; - // Use this for initialization - void OnEnable() - { - text.text = string.Format("GPU: {0}\nDeviceType: {1}\nShaderLevel: {2}\nUVStartsAtTop: {3}", + // Use this for initialization + void OnEnable() + { + title.SetActive(true); + + text.text = string.Format("GPU: {0}\nDeviceType: {1}\nShaderLevel: {2}\nUVStartsAtTop: {3}", SystemInfo.graphicsDeviceName, SystemInfo.graphicsDeviceType, SystemInfo.graphicsShaderLevel, SystemInfo.graphicsUVStartsAtTop); - for (int i = 0; i < softMask.Length; i++) - { - softMaskBufferViewer[i].texture = softMask[i].softMaskBuffer; - } - - } - - // Update is called once per frame - void Update() - { - - } - - public void SetWorldSpase(bool flag) - { - if(flag) - { - GetComponent ().renderMode = RenderMode.ScreenSpaceCamera; - GetComponent ().renderMode = RenderMode.WorldSpace; - transform.rotation = Quaternion.Euler (new Vector3 (0, 6, 0)); - } - } - - public void SetScreenSpase (bool flag) - { - if (flag) - { - GetComponent ().renderMode = RenderMode.ScreenSpaceCamera; - } - } - - public void SetOverlay (bool flag) - { - if (flag) - { - GetComponent ().renderMode = RenderMode.ScreenSpaceOverlay; - } - } - } -} \ No newline at end of file + for (int i = 0; i < softMask.Length; i++) + { + softMaskBufferViewer[i].texture = softMask[i].softMaskBuffer; + } + } + + public void SetWorldSpase(bool flag) + { + if (flag) + { + GetComponent().renderMode = RenderMode.ScreenSpaceCamera; + GetComponent().renderMode = RenderMode.WorldSpace; + transform.rotation = Quaternion.Euler(new Vector3(0, 6, 0)); + } + } + + public void SetScreenSpase(bool flag) + { + if (flag) + { + GetComponent().renderMode = RenderMode.ScreenSpaceCamera; + } + } + + public void SetOverlay(bool flag) + { + if (flag) + { + GetComponent().renderMode = RenderMode.ScreenSpaceOverlay; + } + } + } +} diff --git a/Samples~/Demo/SoftMask_Demo.unity b/Samples~/Demo/SoftMask_Demo.unity index 2ebfe05..d3ac074 100644 --- a/Samples~/Demo/SoftMask_Demo.unity +++ b/Samples~/Demo/SoftMask_Demo.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.3731193, g: 0.38073996, b: 0.35872698, a: 1} + m_IndirectSpecularColor: {r: 0.3731316, g: 0.38074902, b: 0.3587254, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -167,8 +167,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -241,8 +239,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -384,8 +380,6 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.ScrollRect+ScrollRectEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &50857157 GameObject: m_ObjectHideFlags: 0 @@ -441,8 +435,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -532,8 +524,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -627,8 +617,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -718,8 +706,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -809,8 +795,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -904,8 +888,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -998,8 +980,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -1134,8 +1114,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -1337,8 +1315,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -1454,8 +1430,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -1585,8 +1559,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -1681,8 +1653,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 0f125745ff7d640519fb2300ed8a96c7, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -1773,8 +1743,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -1862,8 +1830,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -1988,8 +1954,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 801e306fcae92475592a6d3511bf58d7, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -2062,8 +2026,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -2151,8 +2113,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 801e306fcae92475592a6d3511bf58d7, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -2242,8 +2202,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -2302,8 +2260,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 30 @@ -2423,8 +2379,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -2535,8 +2489,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -2618,8 +2570,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -2745,8 +2695,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 26 @@ -2856,8 +2804,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 37 @@ -2963,7 +2909,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.000061035156} + m_AnchoredPosition: {x: 0, y: 0.00012207031} m_SizeDelta: {x: -20, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &281272271 @@ -3021,8 +2967,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 @@ -3095,8 +3039,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -3186,8 +3128,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -3282,8 +3222,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -3371,8 +3309,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -3524,8 +3460,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &342556806 GameObject: m_ObjectHideFlags: 0 @@ -3713,8 +3647,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -3804,8 +3736,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -3945,8 +3875,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -4021,8 +3949,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -4130,8 +4056,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -4313,8 +4237,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -4409,8 +4331,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -4515,8 +4435,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 @@ -4626,8 +4544,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 @@ -4742,8 +4658,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 0 --- !u!1 &472639756 GameObject: @@ -4821,8 +4735,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -4932,8 +4844,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 1 --- !u!1 &492784862 GameObject: @@ -5010,8 +4920,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -5116,8 +5024,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -5202,8 +5108,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -5425,8 +5329,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 @@ -5520,8 +5422,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -5633,8 +5533,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -5764,8 +5662,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -5901,8 +5797,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &565122535 GameObject: m_ObjectHideFlags: 0 @@ -5975,8 +5869,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -6074,8 +5966,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -6185,8 +6075,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 @@ -6259,8 +6147,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 32 @@ -6370,8 +6256,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -6449,8 +6333,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -6524,8 +6406,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -6631,8 +6511,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -6742,8 +6620,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -6859,8 +6735,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &674301679 GameObject: m_ObjectHideFlags: 0 @@ -6951,8 +6825,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 1 m_CallState: 2 - m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!114 &674301682 MonoBehaviour: m_ObjectHideFlags: 0 @@ -6971,8 +6843,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -7077,8 +6947,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 37 @@ -7177,8 +7045,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -7288,8 +7154,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -7380,8 +7244,6 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.ScrollRect+ScrollRectEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &687763693 GameObject: m_ObjectHideFlags: 0 @@ -7454,8 +7316,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -7531,8 +7391,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -7635,8 +7493,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 801e306fcae92475592a6d3511bf58d7, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -7729,8 +7585,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -7840,8 +7694,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 1 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 0 --- !u!1 &725492602 GameObject: @@ -7915,8 +7767,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -7989,8 +7839,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -8081,8 +7929,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -8261,8 +8107,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -8359,8 +8203,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -8465,8 +8307,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 20 @@ -8546,8 +8386,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -8616,8 +8454,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &836993958 GameObject: m_ObjectHideFlags: 0 @@ -8694,8 +8530,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -8809,8 +8643,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -8891,8 +8723,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Texture: {fileID: 0} m_UVRect: serializedVersion: 2 @@ -8935,7 +8765,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 260.00003, y: -36} + m_AnchoredPosition: {x: 260, y: -36} m_SizeDelta: {x: 233.9, y: 36} m_Pivot: {x: 0, y: 0} --- !u!114 &870704027 @@ -8992,8 +8822,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 1 --- !u!1 &872743970 GameObject: @@ -9051,8 +8879,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -9235,8 +9061,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -9368,8 +9192,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &908458823 GameObject: m_ObjectHideFlags: 0 @@ -9425,8 +9247,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -9514,8 +9334,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 801e306fcae92475592a6d3511bf58d7, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -9609,8 +9427,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -9700,8 +9516,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -9802,14 +9616,12 @@ MonoBehaviour: m_TargetGraphic: {fileID: 50857159} m_HandleRect: {fileID: 50857158} m_Direction: 2 - m_Value: 0.99999994 - m_Size: 0.49043655 + m_Value: 0.9999999 + m_Size: 0.5708701 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.Scrollbar+ScrollEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!114 &948005238 MonoBehaviour: m_ObjectHideFlags: 0 @@ -9828,8 +9640,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -9923,8 +9733,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -10037,8 +9845,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -10148,8 +9954,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -10363,8 +10167,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -10437,8 +10239,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -10528,8 +10328,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -10602,8 +10400,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -10755,8 +10551,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -10855,8 +10649,6 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!114 &1079849198 MonoBehaviour: m_ObjectHideFlags: 0 @@ -10875,8 +10667,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -10996,8 +10786,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 1 m_CallState: 2 - m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!114 &1085974006 MonoBehaviour: m_ObjectHideFlags: 0 @@ -11016,8 +10804,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -11127,8 +10913,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 0 --- !u!1 &1104778163 GameObject: @@ -11217,8 +11001,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -11341,8 +11123,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Texture: {fileID: 0} m_UVRect: serializedVersion: 2 @@ -11422,8 +11202,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -11528,8 +11306,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -11639,8 +11415,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -11718,8 +11492,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -11797,8 +11569,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -11888,8 +11658,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -11979,8 +11747,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -12053,8 +11819,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -12127,8 +11891,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 @@ -12275,8 +12037,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -12380,8 +12140,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -12547,8 +12305,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -12621,8 +12377,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 86 @@ -12700,8 +12454,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -12791,8 +12543,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -12870,8 +12620,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -12961,8 +12709,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -13056,8 +12802,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -13154,8 +12898,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -13216,8 +12958,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!222 &1331430616 CanvasRenderer: m_ObjectHideFlags: 0 @@ -13337,8 +13077,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -13428,8 +13166,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -13539,8 +13275,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -13671,8 +13405,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -13782,8 +13514,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -13865,8 +13595,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -14018,8 +13746,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &1419027202 GameObject: m_ObjectHideFlags: 0 @@ -14124,8 +13850,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 @@ -14224,8 +13948,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 157 @@ -14326,8 +14048,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -14420,8 +14140,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -14518,8 +14236,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -14612,8 +14328,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -14707,8 +14421,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -14834,8 +14546,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -14925,8 +14635,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -15018,8 +14726,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -15109,8 +14815,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -15200,8 +14904,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -15295,8 +14997,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -15422,8 +15122,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -15549,8 +15247,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -15628,8 +15324,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 @@ -15777,8 +15471,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -15904,8 +15596,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 36 @@ -15986,8 +15676,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -16081,8 +15769,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -16175,8 +15861,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -16266,8 +15950,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -16485,8 +16167,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -16579,8 +16259,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -16655,8 +16333,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 @@ -16797,8 +16473,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -16888,8 +16562,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -16987,8 +16659,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -17098,8 +16768,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -17194,8 +16862,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -17338,8 +17004,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 1 --- !u!1 &1731734723 GameObject: @@ -17376,7 +17040,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 520.00006, y: -36} + m_AnchoredPosition: {x: 520, y: -36} m_SizeDelta: {x: 233.9, y: 36} m_Pivot: {x: 0, y: 0} --- !u!114 &1731734725 @@ -17433,8 +17097,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 0 --- !u!1 &1740779739 GameObject: @@ -17523,8 +17185,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -17619,8 +17279,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -17787,8 +17445,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -17861,8 +17517,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -17956,8 +17610,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -18050,8 +17702,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -18167,8 +17817,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &1796917391 GameObject: m_ObjectHideFlags: 0 @@ -18257,8 +17905,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -18348,8 +17994,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 220 @@ -18458,8 +18102,6 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.Scrollbar+ScrollEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!114 &1798098157 MonoBehaviour: m_ObjectHideFlags: 0 @@ -18478,8 +18120,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -18584,8 +18224,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 20 @@ -18712,8 +18350,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -18791,8 +18427,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 @@ -18914,8 +18548,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 37 @@ -18992,8 +18624,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -19070,8 +18700,6 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &1874449694 GameObject: m_ObjectHideFlags: 0 @@ -19144,8 +18772,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 28 @@ -19266,8 +18892,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null --- !u!1 &1875764026 GameObject: m_ObjectHideFlags: 0 @@ -19417,8 +19041,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 20 @@ -19515,8 +19137,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -19589,8 +19209,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -19680,8 +19298,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -19796,8 +19412,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null m_IsOn: 1 --- !u!1 &1944994932 GameObject: @@ -19854,8 +19468,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -19949,8 +19561,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -20060,8 +19670,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -20155,8 +19763,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -20301,8 +19907,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 28 @@ -20401,8 +20005,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -20548,8 +20150,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -20644,8 +20244,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: e5a8e8d861f62472d8f99611cf9d12c5, type: 3} m_Type: 0 m_PreserveAspect: 0 @@ -20750,8 +20348,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 @@ -20862,8 +20458,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -21000,6 +20594,7 @@ MonoBehaviour: - {fileID: 2105854281} - {fileID: 498443930} text: {fileID: 213387626} + title: {fileID: 1331430612} --- !u!1 &2067309659 GameObject: m_ObjectHideFlags: 0 @@ -21072,8 +20667,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: 3ad57d818b4f448a190e524e494130b0, type: 3} m_Type: 2 m_PreserveAspect: 0 @@ -21167,8 +20760,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 @@ -21346,8 +20937,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 37 @@ -21474,8 +21063,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 32 @@ -21570,8 +21157,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 @@ -21671,8 +21256,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 21300000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_Type: 1 m_PreserveAspect: 0 @@ -21774,8 +21357,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 @@ -21848,8 +21429,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 @@ -21939,8 +21518,6 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: ab2cfde409d710b47b0b502877abb479, type: 3} m_FontSize: 42 diff --git a/Samples~/Demo/Unity-chan.png.meta b/Samples~/Demo/Unity-chan.png.meta index a88f0c5..2610950 100644 --- a/Samples~/Demo/Unity-chan.png.meta +++ b/Samples~/Demo/Unity-chan.png.meta @@ -1,10 +1,9 @@ fileFormatVersion: 2 guid: e5a8e8d861f62472d8f99611cf9d12c5 -timeCreated: 1539763439 -licenseType: Pro TextureImporter: fileIDToRecycleName: {} - serializedVersion: 4 + externalObjects: {} + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -12,6 +11,8 @@ TextureImporter: linearTexture: 0 fadeOut: 0 borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: @@ -20,6 +21,8 @@ TextureImporter: heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -27,10 +30,13 @@ TextureImporter: textureFormat: 1 maxTextureSize: 2048 textureSettings: + serializedVersion: 2 filterMode: -1 aniso: 16 - mipBias: -1 - wrapMode: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 nPOTScale: 0 lightmap: 0 compressionQuality: 50 @@ -39,62 +45,88 @@ TextureImporter: spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 8 textureShape: 1 + singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - buildTarget: DefaultTexturePlatform + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Standalone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: iPhone + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: Android + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - - buildTarget: WebGL + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL maxTextureSize: 2048 + resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] + physicsShape: [] + bones: [] + spriteID: 351a811034e0f411db84265dae66b273 + vertices: [] + indices: + edges: [] + weights: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Scripts/Editor/EditorUtils.cs b/Scripts/Editor/EditorUtils.cs new file mode 100644 index 0000000..d41f9f7 --- /dev/null +++ b/Scripts/Editor/EditorUtils.cs @@ -0,0 +1,57 @@ +#if UNITY_2018_3_OR_NEWER +using UnityEditor.Experimental.SceneManagement; +#endif +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; + + +namespace Coffee.UISoftMask +{ + internal static class EditorUtils + { + internal static void MarkPrefabDirty() + { +#if UNITY_2018_3_OR_NEWER + var prefabStage = PrefabStageUtility.GetCurrentPrefabStage(); + if (prefabStage == null) return; + EditorSceneManager.MarkSceneDirty(prefabStage.scene); +#endif + } + + /// + /// Verify whether it can be converted to the specified component. + /// + internal static bool CanConvertTo(Object context) where T : MonoBehaviour + { + return context && context.GetType() != typeof(T); + } + + /// + /// Convert to the specified component. + /// + internal static void ConvertTo(Object context) where T : MonoBehaviour + { + var target = context as MonoBehaviour; + var so = new SerializedObject(target); + so.Update(); + + bool oldEnable = target.enabled; + target.enabled = false; + + // Find MonoScript of the specified component. + foreach (var script in Resources.FindObjectsOfTypeAll()) + { + if (script.GetClass() != typeof(T)) + continue; + + // Set 'm_Script' to convert. + so.FindProperty("m_Script").objectReferenceValue = script; + so.ApplyModifiedProperties(); + break; + } + + (so.targetObject as MonoBehaviour).enabled = oldEnable; + } + } +} diff --git a/Scripts/Editor/Utils.cs.meta b/Scripts/Editor/EditorUtils.cs.meta similarity index 100% rename from Scripts/Editor/Utils.cs.meta rename to Scripts/Editor/EditorUtils.cs.meta diff --git a/Scripts/Editor/ImportSampleMenu.cs b/Scripts/Editor/ImportSampleMenu.cs index 78db652..c61a9d1 100644 --- a/Scripts/Editor/ImportSampleMenu.cs +++ b/Scripts/Editor/ImportSampleMenu.cs @@ -4,9 +4,9 @@ using System.Text.RegularExpressions; using UnityEditor; -namespace Coffee.UIExtensions +namespace Coffee.UISoftMask { - public static class ImportSampleMenu_UISoftMask + public static class ImportSampleMenu { [MenuItem("Assets/Samples/Import UISoftMask Sample")] private static void ImportSample() diff --git a/Scripts/Editor/SoftMaskEditor.cs b/Scripts/Editor/SoftMaskEditor.cs index 80a1c1c..8116ea0 100644 --- a/Scripts/Editor/SoftMaskEditor.cs +++ b/Scripts/Editor/SoftMaskEditor.cs @@ -5,130 +5,103 @@ using System.Linq; -namespace Coffee.UIExtensions.Editors +namespace Coffee.UISoftMask { - /// - /// SoftMask editor. - /// - [CustomEditor(typeof(SoftMask))] - [CanEditMultipleObjects] - public class SoftMaskEditor : Editor - { - const string k_PrefsPreview = "SoftMaskEditor_Preview"; - static readonly List s_Graphics = new List (); - static bool s_Preview; - - private void OnEnable () - { - s_Preview = EditorPrefs.GetBool (k_PrefsPreview, false); - } - - public override void OnInspectorGUI () - { - base.OnInspectorGUI (); - - var current = target as SoftMask; - current.GetComponentsInChildren (true, s_Graphics); - var fixTargets = s_Graphics.Where (x => x.gameObject != current.gameObject && !x.GetComponent () && (!x.GetComponent () || x.GetComponent ().showMaskGraphic)).ToList (); - if (0 < fixTargets.Count) - { - GUILayout.BeginHorizontal (); - EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning); - GUILayout.BeginVertical (); - if (GUILayout.Button ("Fix")) - { - foreach (var p in fixTargets) - { - p.gameObject.AddComponent (); - } - - Utils.MarkPrefabDirty (); - } - if (GUILayout.Button ("Ping")) - { - EditorGUIUtility.PingObject (fixTargets[0]); - } - GUILayout.EndVertical (); - GUILayout.EndHorizontal (); - } - - // Preview buffer. - GUILayout.BeginHorizontal (EditorStyles.helpBox); - if (s_Preview != (s_Preview = EditorGUILayout.ToggleLeft ("Preview Buffer", s_Preview, GUILayout.MaxWidth (EditorGUIUtility.labelWidth)))) - { - EditorPrefs.SetBool (k_PrefsPreview, s_Preview); - } - if (s_Preview) - { - var tex = current.softMaskBuffer; - var width = tex.width * 64 / tex.height; - EditorGUI.DrawPreviewTexture (GUILayoutUtility.GetRect (width, 64), tex, null, ScaleMode.ScaleToFit); - Repaint (); - } - GUILayout.FlexibleSpace (); - GUILayout.EndHorizontal (); - } - - - //%%%% Context menu for editor %%%% - [MenuItem("CONTEXT/Mask/Convert To SoftMask", true)] - static bool _ConvertToSoftMask(MenuCommand command) - { - return CanConvertTo(command.context); - } - - [MenuItem("CONTEXT/Mask/Convert To SoftMask", false)] - static void ConvertToSoftMask(MenuCommand command) - { - ConvertTo(command.context); - } - - [MenuItem("CONTEXT/Mask/Convert To Mask", true)] - static bool _ConvertToMask(MenuCommand command) - { - return CanConvertTo(command.context); - } - - [MenuItem("CONTEXT/Mask/Convert To Mask", false)] - static void ConvertToMask(MenuCommand command) - { - ConvertTo(command.context); - } - - /// - /// Verify whether it can be converted to the specified component. - /// - protected static bool CanConvertTo(Object context) - where T : MonoBehaviour - { - return context && context.GetType() != typeof(T); - } - - /// - /// Convert to the specified component. - /// - protected static void ConvertTo(Object context) where T : MonoBehaviour - { - var target = context as MonoBehaviour; - var so = new SerializedObject(target); - so.Update(); - - bool oldEnable = target.enabled; - target.enabled = false; - - // Find MonoScript of the specified component. - foreach (var script in Resources.FindObjectsOfTypeAll()) - { - if (script.GetClass() != typeof(T)) - continue; - - // Set 'm_Script' to convert. - so.FindProperty("m_Script").objectReferenceValue = script; - so.ApplyModifiedProperties(); - break; - } - - (so.targetObject as MonoBehaviour).enabled = oldEnable; - } - } -} \ No newline at end of file + /// + /// SoftMask editor. + /// + [CustomEditor(typeof(SoftMask))] + [CanEditMultipleObjects] + public class SoftMaskEditor : Editor + { + const string k_PrefsPreview = "SoftMaskEditor_Preview"; + static readonly List s_Graphics = new List(); + static bool s_Preview; + + private void OnEnable() + { + s_Preview = EditorPrefs.GetBool(k_PrefsPreview, false); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + var current = target as SoftMask; + current.GetComponentsInChildren(true, s_Graphics); + var fixTargets = s_Graphics.Where(x => + x.gameObject != current.gameObject && !x.GetComponent() && + (!x.GetComponent() || x.GetComponent().showMaskGraphic)).ToList(); + if (0 < fixTargets.Count) + { + GUILayout.BeginHorizontal(); + EditorGUILayout.HelpBox( + "There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", + MessageType.Warning); + GUILayout.BeginVertical(); + if (GUILayout.Button("Fix")) + { + foreach (var p in fixTargets) + { + p.gameObject.AddComponent(); + } + + EditorUtils.MarkPrefabDirty(); + } + + if (GUILayout.Button("Ping")) + { + EditorGUIUtility.PingObject(fixTargets[0]); + } + + GUILayout.EndVertical(); + GUILayout.EndHorizontal(); + } + + // Preview buffer. + GUILayout.BeginHorizontal(EditorStyles.helpBox); + if (s_Preview != (s_Preview = EditorGUILayout.ToggleLeft("Preview Buffer", s_Preview, + GUILayout.MaxWidth(EditorGUIUtility.labelWidth)))) + { + EditorPrefs.SetBool(k_PrefsPreview, s_Preview); + } + + if (s_Preview) + { + var tex = current.softMaskBuffer; + var width = tex.width * 64 / tex.height; + EditorGUI.DrawPreviewTexture(GUILayoutUtility.GetRect(width, 64), tex, null, ScaleMode.ScaleToFit); + Repaint(); + } + + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + } + + + //%%%% Context menu for editor %%%% + [MenuItem("CONTEXT/Mask/Convert To SoftMask", true)] + static bool _ConvertToSoftMask(MenuCommand command) + { + return EditorUtils.CanConvertTo(command.context); + } + + [MenuItem("CONTEXT/Mask/Convert To SoftMask", false)] + static void ConvertToSoftMask(MenuCommand command) + { + EditorUtils.ConvertTo(command.context); + } + + [MenuItem("CONTEXT/Mask/Convert To Mask", true)] + static bool _ConvertToMask(MenuCommand command) + { + return EditorUtils.CanConvertTo(command.context); + } + + [MenuItem("CONTEXT/Mask/Convert To Mask", false)] + static void ConvertToMask(MenuCommand command) + { + EditorUtils.ConvertTo(command.context); + } + } +} diff --git a/Scripts/Editor/SoftMaskableEditor.cs b/Scripts/Editor/SoftMaskableEditor.cs index 3f1fd41..54272f9 100644 --- a/Scripts/Editor/SoftMaskableEditor.cs +++ b/Scripts/Editor/SoftMaskableEditor.cs @@ -9,405 +9,176 @@ using MaskIntr = UnityEngine.SpriteMaskInteraction; using System.IO; -namespace Coffee.UIExtensions.Editors +namespace Coffee.UISoftMask { - /// - /// SoftMaskable editor. - /// - [CustomEditor (typeof (SoftMaskable))] - [CanEditMultipleObjects] - public class SoftMaskableEditor : Editor - { - //################################ - // Constant or Static Members. - //################################ - public enum MaskInteraction : int - { - VisibleInsideMask = (1 << 0) + (1 << 2) + (1 << 4) + (1 << 6), - VisibleOutsideMask = (2 << 0) + (2 << 2) + (2 << 4) + (2 << 6), - Custom = -1, - } - - MaskInteraction maskInteraction - { - get - { - int value = _spMaskInteraction.intValue; - return _custom - ? MaskInteraction.Custom - : System.Enum.IsDefined(typeof(MaskInteraction), value) - ? (MaskInteraction)value - : MaskInteraction.Custom; - } - set - { - _custom = (value == MaskInteraction.Custom); - if (!_custom) - { - _spMaskInteraction.intValue = (int)value; - } - } - } - bool _custom = false; - - static readonly Type s_TypeTMPro = AppDomain.CurrentDomain.GetAssemblies ().SelectMany (x => x.GetTypes ()).FirstOrDefault (x => x.Name == "TMP_Text"); - static readonly Type s_TypeTMP_SpriteAsset = AppDomain.CurrentDomain.GetAssemblies ().SelectMany (x => x.GetTypes ()).FirstOrDefault (x => x.Name == "TMP_SpriteAsset"); - static readonly Type s_TypeTMProSettings = AppDomain.CurrentDomain.GetAssemblies ().SelectMany (x => x.GetTypes ()).FirstOrDefault (x => x.Name == "TMP_Settings"); - static readonly Type s_TypeTMP_SubMesh = AppDomain.CurrentDomain.GetAssemblies ().SelectMany (x => x.GetTypes ()).FirstOrDefault (x => x.Name == "TMP_SubMesh"); - static readonly Type s_TypeTMP_SubMeshUI = AppDomain.CurrentDomain.GetAssemblies ().SelectMany (x => x.GetTypes ()).FirstOrDefault (x => x.Name == "TMP_SubMeshUI"); - static PropertyInfo s_PiFontSharedMaterial; - static PropertyInfo s_PiFontSharedMaterials; - static PropertyInfo s_PiSpriteAsset; - static PropertyInfo s_PiRichText; - static PropertyInfo s_PiText; - static PropertyInfo s_PiDefaultFontAssetPath; - static PropertyInfo s_PiDefaultSpriteAssetPath; - static FieldInfo s_FiMaterial; - static MethodInfo s_miGetSpriteAsset; - static readonly List s_Graphics = new List (); - Shader _shader; - Shader _mobileShader; - Shader _spriteShader; - List _materialEditors = new List (); - SerializedProperty _spMaskInteraction; - - void OnEnable () - { - _spMaskInteraction = serializedObject.FindProperty("m_MaskInteraction"); - _custom = (maskInteraction == MaskInteraction.Custom); - - ClearMaterialEditors (); - - _shader = Shader.Find ("TextMeshPro/Distance Field (SoftMaskable)"); - _mobileShader = Shader.Find ("TextMeshPro/Mobile/Distance Field (SoftMaskable)"); - _spriteShader = Shader.Find ("TextMeshPro/Sprite (SoftMaskable)"); - - if(s_TypeTMPro != null) - { - s_PiFontSharedMaterial = s_TypeTMPro.GetProperty ("fontSharedMaterial"); - s_PiSpriteAsset = s_TypeTMPro.GetProperty ("spriteAsset"); - s_PiRichText = s_TypeTMPro.GetProperty ("richText"); - s_PiText = s_TypeTMPro.GetProperty ("text"); - s_FiMaterial = s_TypeTMP_SpriteAsset.GetField ("material"); - s_PiFontSharedMaterials = s_TypeTMPro.GetProperty ("fontSharedMaterials"); - s_miGetSpriteAsset = s_TypeTMProSettings.GetMethod ("GetSpriteAsset", BindingFlags.Static | BindingFlags.Public); - - s_PiDefaultFontAssetPath = s_TypeTMProSettings.GetProperty ("defaultFontAssetPath", BindingFlags.Static | BindingFlags.Public); - s_PiDefaultSpriteAssetPath = s_TypeTMProSettings.GetProperty ("defaultSpriteAssetPath", BindingFlags.Static | BindingFlags.Public); - } - - s_MaskWarning = new GUIContent(EditorGUIUtility.FindTexture("console.warnicon.sml"), "This component is not SoftMask. Use SoftMask instead of Mask."); - } - - void OnDisable () - { - ClearMaterialEditors (); - } - - List tmpMasks = new List(); - - void DrawMaskInteractions() - { - (target as SoftMaskable).GetComponentsInParent(true, tmpMasks); - tmpMasks.RemoveAll(x => !x.enabled); - tmpMasks.Reverse(); - - maskInteraction = (MaskInteraction)EditorGUILayout.EnumPopup("Mask Interaction", maskInteraction); - if (_custom) - { - var l = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 45; - - using (var ccs = new EditorGUI.ChangeCheckScope()) - { - int intr0 = DrawMaskInteraction(0); - int intr1 = DrawMaskInteraction(1); - int intr2 = DrawMaskInteraction(2); - int intr3 = DrawMaskInteraction(3); - - if (ccs.changed) { - _spMaskInteraction.intValue = (intr0 << 0) + (intr1 << 2) + (intr2 << 4) + (intr3 << 6); - } - } - - EditorGUIUtility.labelWidth = l; - } - } - - static GUIContent s_MaskWarning = new GUIContent(); - - int DrawMaskInteraction(int layer) - { - Mask mask = layer < tmpMasks.Count ? tmpMasks[layer] : null; - MaskIntr intr = (MaskIntr)((_spMaskInteraction.intValue >> layer * 2) & 0x3); - if (!mask) - { - return (int)intr; - } - - using (new EditorGUILayout.HorizontalScope()) - { - EditorGUILayout.LabelField(mask is SoftMask ? GUIContent.none : s_MaskWarning, GUILayout.Width(16)); - GUILayout.Space(-5); - EditorGUILayout.ObjectField("Mask " + layer, mask, typeof(Mask), false); - GUILayout.Space(-15); - return (int)(MaskIntr)EditorGUILayout.EnumPopup(intr); - } - } - - public override void OnInspectorGUI () - { - base.OnInspectorGUI (); - - serializedObject.Update(); - DrawMaskInteractions(); - -// maskInteraction = (MaskInteraction)EditorGUILayout.EnumPopup("Mask Interaction", maskInteraction); - serializedObject.ApplyModifiedProperties(); - /* - EditorGUI.indentLevel++; - var l = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 60; - using (new EditorGUILayout.HorizontalScope()) - { - EditorGUILayout.ObjectField("Mask 0", null, typeof(Mask), false); - EditorGUILayout.EnumPopup (MaskIntr.None); - } - EditorGUIUtility.labelWidth = l; - EditorGUI.indentLevel--; - - var spMaskInteraction = serializedObject.FindProperty ("m_MaskInteraction"); - MaskIntr intr0 = (MaskIntr)((spMaskInteraction.intValue >> 0) & 0x3); - MaskIntr intr1 = (MaskIntr)((spMaskInteraction.intValue >> 2) & 0x3); - MaskIntr intr2 = (MaskIntr)((spMaskInteraction.intValue >> 4) & 0x3); - MaskIntr intr3 = (MaskIntr)((spMaskInteraction.intValue >> 6) & 0x3); - - using (var ccs = new EditorGUI.ChangeCheckScope ()) { - - intr0 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 0", intr0); - intr1 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 1", intr1); - intr2 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 2", intr2); - intr3 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 3", intr3); - - if (ccs.changed) { - current.SetMaskInteractions (intr0,intr1,intr2,intr3); - } - } - */ - -// spMaskInteraction.intValue = (intr0 << 0) | (intr1 << 2) | (intr2 << 4) | (intr3 << 6); -// -// serializedObject.ApplyModifiedProperties (); - - - - var current = target as SoftMaskable; - - current.GetComponentsInChildren (true, s_Graphics); - var fixTargets = s_Graphics.Where (x => x.gameObject != current.gameObject && !x.GetComponent () && (!x.GetComponent () || x.GetComponent ().showMaskGraphic)).ToList (); - if (0 < fixTargets.Count) - { - GUILayout.BeginHorizontal (); - EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning); - GUILayout.BeginVertical (); - if (GUILayout.Button ("Fix")) - { - foreach (var p in fixTargets) - { - p.gameObject.AddComponent (); - } - } - if (GUILayout.Button ("Ping")) - { - EditorGUIUtility.PingObject (fixTargets [0]); - } - GUILayout.EndVertical (); - GUILayout.EndHorizontal (); - } - - if(s_TypeTMPro != null) - { - ShowTMProWarning (_shader, _mobileShader, _spriteShader, m => { }); - var textMeshPro = current.GetComponent (s_TypeTMPro); - if (textMeshPro != null) - { - Material [] fontSharedMaterials = s_PiFontSharedMaterials.GetValue (textMeshPro, new object [0]) as Material []; - ShowMaterialEditors (fontSharedMaterials, 1, fontSharedMaterials.Length - 1); - } - } - - if (!DetectMask (current.transform.parent)) - { - GUILayout.BeginHorizontal (); - EditorGUILayout.HelpBox ("This is unnecessary SoftMaskable.\nCan't find any SoftMask components above.", MessageType.Warning); - if (GUILayout.Button ("Remove", GUILayout.Height (40))) - { - DestroyImmediate (current); - - Utils.MarkPrefabDirty (); - } - GUILayout.EndHorizontal (); - } - } - - static bool DetectMask (Transform transform) - { - if (transform == null) - { - return false; - } - - if (transform.GetComponent () != null) - { - return true; - } - - return DetectMask (transform.parent); - } - - void ClearMaterialEditors () - { - foreach (var e in _materialEditors) - { - if (e) - { - DestroyImmediate (e); - } - } - _materialEditors.Clear (); - } - - protected void ShowMaterialEditors (Material [] materials, int startIndex, int count) - { - for (int i = 0; i < count; i++) - { - if (_materialEditors.Count == i) - { - _materialEditors.Add (null); - } - - var mat = materials [startIndex + i]; - var editor = _materialEditors [i]; - if (editor && editor.target != mat) - { - DestroyImmediate (editor); - editor = null; - } - - if (!editor) - { - editor = _materialEditors [i] = Editor.CreateEditor (mat) as MaterialEditor; - } - - editor.DrawHeader (); - editor.OnInspectorGUI (); - } - } - - public void ShowTMProWarning (Shader shader, Shader mobileShader, Shader spriteShader, System.Action onCreatedMaterial) - { - var current = target as SoftMaskable; - var textMeshPro = current.GetComponent (s_TypeTMPro); - if (textMeshPro == null) - { - return; - } - - Material fontSharedMaterial = s_PiFontSharedMaterial.GetValue (textMeshPro, new object [0]) as Material; - if (fontSharedMaterial == null) - { - return; - } - - // Is the material preset for dissolve? - Material m = fontSharedMaterial; - if (m.shader != shader && m.shader != mobileShader) - { - EditorGUILayout.BeginHorizontal (); - EditorGUILayout.HelpBox (string.Format ("{0} requires '{1}' or '{2}' as a shader for material preset.", current.GetType ().Name, shader.name, mobileShader.name), MessageType.Warning); - if (GUILayout.Button ("Fix")) - { - var correctShader = m.shader.name.Contains ("Mobile") ? mobileShader : shader; - m = ModifyTMProMaterialPreset (m, correctShader, onCreatedMaterial); - s_PiFontSharedMaterial.SetValue (textMeshPro, m, new object [0]); - } - EditorGUILayout.EndHorizontal (); - return; - } - - // Is the sprite asset for dissolve? - object spriteAsset = s_PiSpriteAsset.GetValue (textMeshPro, new object [0]) ?? s_miGetSpriteAsset.Invoke (null, new object [0]); - //TMP_SpriteAsset spriteAsset = textMeshPro.spriteAsset ?? TMP_Settings.GetSpriteAsset (); - m = s_FiMaterial.GetValue (spriteAsset) as Material; - bool hasSprite = (bool)s_PiRichText.GetValue (textMeshPro, new object [0]) && (s_PiText.GetValue (textMeshPro, new object [0]) as string).Contains (" x.gameObject).ToList ().ForEach (DestroyImmediate); - current.GetComponentsInChildren (s_TypeTMP_SubMeshUI).Select (x => x.gameObject).ToList ().ForEach (DestroyImmediate); - spriteAsset = ModifyTMProSpriteAsset (m, _spriteShader, mat => { }); - s_PiSpriteAsset.SetValue (textMeshPro, spriteAsset, new object [0]); - } - EditorGUILayout.EndHorizontal (); - return; - } - } - - Material ModifyTMProMaterialPreset (Material baseMaterial, Shader shader, System.Action onCreatedMaterial) - { - string path = AssetDatabase.GetAssetPath (baseMaterial); - string filename = Path.GetFileNameWithoutExtension (path) + " (" + typeof (SoftMaskable).Name + ")"; - string defaultAssetPath = s_PiDefaultFontAssetPath.GetValue (null, new object [0]) as string; - Material mat = Resources.Load (defaultAssetPath + filename); - if (!mat) - { - mat = new Material (baseMaterial) - { - shaderKeywords = baseMaterial.shaderKeywords, - shader = shader, - }; - onCreatedMaterial (mat); - AssetDatabase.CreateAsset (mat, Path.GetDirectoryName (path) + "/" + filename + ".mat"); - - EditorUtility.FocusProjectWindow (); - EditorGUIUtility.PingObject (mat); - } - else - { - mat.shader = shader; - } - EditorUtility.SetDirty (mat); - return mat; - } - - object ModifyTMProSpriteAsset (Material baseMaterial, Shader shader, System.Action onCreatedMaterial) - { - string path = AssetDatabase.GetAssetPath (baseMaterial); - string filename = Path.GetFileNameWithoutExtension (path) + " (" + typeof (SoftMaskable).Name + ")"; - string defaultAssetPath = s_PiDefaultSpriteAssetPath.GetValue (null, new object [0]) as string; - Object spriteAsset = Resources.Load (defaultAssetPath + filename, s_TypeTMP_SpriteAsset); - if (spriteAsset == null) - { - AssetDatabase.CopyAsset (path, Path.GetDirectoryName (path) + "/" + filename + ".mat"); - spriteAsset = Resources.Load (defaultAssetPath + filename, s_TypeTMP_SpriteAsset); - Material m = s_FiMaterial.GetValue (spriteAsset) as Material; - m.shader = shader; - m.name = shader.name; - onCreatedMaterial (m); - - EditorUtility.FocusProjectWindow (); - EditorGUIUtility.PingObject (spriteAsset); - } - else - { - Material m = s_FiMaterial.GetValue (spriteAsset) as Material; - m.shader = shader; - } - EditorUtility.SetDirty (spriteAsset); - return spriteAsset; - } - } -} \ No newline at end of file + /// + /// SoftMaskable editor. + /// + [CustomEditor(typeof(SoftMaskable))] + [CanEditMultipleObjects] + public class SoftMaskableEditor : Editor + { + public enum MaskInteraction : int + { + VisibleInsideMask = (1 << 0) + (1 << 2) + (1 << 4) + (1 << 6), + VisibleOutsideMask = (2 << 0) + (2 << 2) + (2 << 4) + (2 << 6), + Custom = -1, + } + + MaskInteraction maskInteraction + { + get + { + int value = _spMaskInteraction.intValue; + return _custom + ? MaskInteraction.Custom + : System.Enum.IsDefined(typeof(MaskInteraction), value) + ? (MaskInteraction) value + : MaskInteraction.Custom; + } + set + { + _custom = (value == MaskInteraction.Custom); + if (!_custom) + { + _spMaskInteraction.intValue = (int) value; + } + } + } + + bool _custom = false; + + static readonly List s_Graphics = new List(); + SerializedProperty _spMaskInteraction; + List tmpMasks = new List(); + static GUIContent s_MaskWarning; + + + private void OnEnable() + { + _spMaskInteraction = serializedObject.FindProperty("m_MaskInteraction"); + _custom = (maskInteraction == MaskInteraction.Custom); + s_MaskWarning = new GUIContent(EditorGUIUtility.FindTexture("console.warnicon.sml"), + "This is not a SoftMask component."); + } + + + private void DrawMaskInteractions() + { + var softMaskable = target as SoftMaskable; + if (softMaskable == null) return; + + softMaskable.GetComponentsInParent(true, tmpMasks); + tmpMasks.RemoveAll(x => !x.enabled); + tmpMasks.Reverse(); + + maskInteraction = (MaskInteraction) EditorGUILayout.EnumPopup("Mask Interaction", maskInteraction); + if (!_custom) return; + + var l = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 45; + + using (var ccs = new EditorGUI.ChangeCheckScope()) + { + int intr0 = DrawMaskInteraction(0); + int intr1 = DrawMaskInteraction(1); + int intr2 = DrawMaskInteraction(2); + int intr3 = DrawMaskInteraction(3); + + if (ccs.changed) + { + _spMaskInteraction.intValue = (intr0 << 0) + (intr1 << 2) + (intr2 << 4) + (intr3 << 6); + } + } + + EditorGUIUtility.labelWidth = l; + } + + + private int DrawMaskInteraction(int layer) + { + Mask mask = layer < tmpMasks.Count ? tmpMasks[layer] : null; + MaskIntr intr = (MaskIntr) ((_spMaskInteraction.intValue >> layer * 2) & 0x3); + if (!mask) + { + return (int) intr; + } + + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUILayout.LabelField(mask is SoftMask ? GUIContent.none : s_MaskWarning, GUILayout.Width(16)); + GUILayout.Space(-5); + EditorGUILayout.ObjectField("Mask " + layer, mask, typeof(Mask), false); + GUILayout.Space(-15); + return (int) (MaskIntr) EditorGUILayout.EnumPopup(intr); + } + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + serializedObject.Update(); + DrawMaskInteractions(); + + serializedObject.ApplyModifiedProperties(); + + var current = target as SoftMaskable; + + current.GetComponentsInChildren(true, s_Graphics); + var fixTargets = s_Graphics.Where(x => + x.gameObject != current.gameObject && !x.GetComponent() && + (!x.GetComponent() || x.GetComponent().showMaskGraphic)).ToList(); + if (0 < fixTargets.Count) + { + GUILayout.BeginHorizontal(); + EditorGUILayout.HelpBox( + "There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", + MessageType.Warning); + GUILayout.BeginVertical(); + if (GUILayout.Button("Fix")) + { + foreach (var p in fixTargets) + { + p.gameObject.AddComponent(); + } + } + + if (GUILayout.Button("Ping")) + { + EditorGUIUtility.PingObject(fixTargets[0]); + } + + GUILayout.EndVertical(); + GUILayout.EndHorizontal(); + } + + if (!DetectMask(current.transform.parent)) + { + GUILayout.BeginHorizontal(); + EditorGUILayout.HelpBox("This is unnecessary SoftMaskable.\nCan't find any SoftMask components above.", + MessageType.Warning); + if (GUILayout.Button("Remove", GUILayout.Height(40))) + { + DestroyImmediate(current); + + EditorUtils.MarkPrefabDirty(); + } + + GUILayout.EndHorizontal(); + } + } + + static bool DetectMask(Transform transform) + { + while (transform) + { + if (transform.GetComponent()) return true; + + transform = transform.parent; + } + + return false; + } + } +} diff --git a/Scripts/Editor/Utils.cs b/Scripts/Editor/Utils.cs deleted file mode 100644 index 3dcaea8..0000000 --- a/Scripts/Editor/Utils.cs +++ /dev/null @@ -1,22 +0,0 @@ -#if UNITY_2018_3_OR_NEWER -using UnityEditor.Experimental.SceneManagement; -#endif -using UnityEditor.SceneManagement; - - -namespace Coffee.UIExtensions.Editors -{ - public static class Utils - { - public static void MarkPrefabDirty () - { - #if UNITY_2018_3_OR_NEWER - var prefabStage = PrefabStageUtility.GetCurrentPrefabStage (); - if (prefabStage != null) - { - EditorSceneManager.MarkSceneDirty (prefabStage.scene); - } - #endif - } - } -} \ No newline at end of file diff --git a/Scripts/GraphicConnector.cs b/Scripts/GraphicConnector.cs new file mode 100644 index 0000000..a437335 --- /dev/null +++ b/Scripts/GraphicConnector.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace Coffee.UISoftMask +{ + internal static class GraphicConnectorExtension + { + public static void SetVerticesDirtyEx(this Graphic graphic) + { + GraphicConnector.FindConnector(graphic).SetVerticesDirty(graphic); + } + + public static void SetMaterialDirtyEx(this Graphic graphic) + { + GraphicConnector.FindConnector(graphic).SetMaterialDirty(graphic); + } + + public static Shader FindEffectShader(this Graphic graphic) + { + return GraphicConnector.FindConnector(graphic).FindEffectShader(graphic); + } + } + + + public class GraphicConnector + { + private static readonly List s_Connectors = new List(); + + private static readonly Dictionary s_ConnectorMap = + new Dictionary(); + + private static readonly GraphicConnector s_EmptyConnector = new GraphicConnector(); + +#if UNITY_EDITOR + [UnityEditor.InitializeOnLoadMethod] +#endif + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] + private static void Init() + { + AddConnector(new GraphicConnector()); + } + + protected static void AddConnector(GraphicConnector connector) + { + s_Connectors.Add(connector); + s_Connectors.Sort((x, y) => y.priority - x.priority); + } + + public static GraphicConnector FindConnector(Graphic graphic) + { + if (!graphic) return s_EmptyConnector; + + var type = graphic.GetType(); + GraphicConnector connector = null; + if (s_ConnectorMap.TryGetValue(type, out connector)) return connector; + + foreach (var c in s_Connectors) + { + if (!c.IsValid(graphic)) continue; + + s_ConnectorMap.Add(type, c); + return c; + } + + return s_EmptyConnector; + } + + /// + /// Connector priority. + /// + protected virtual int priority + { + get { return -1; } + } + + + /// + /// Find effect shader. + /// + public virtual Shader FindEffectShader(Graphic graphic) + { + return Shader.Find("Hidden/UI/SoftMaskable"); + } + + /// + /// The connector is valid for the component. + /// + protected virtual bool IsValid(Graphic graphic) + { + return true; + } + + public virtual void SetVerticesDirty(Graphic graphic) + { + if (graphic) + graphic.SetVerticesDirty(); + } + + public virtual void SetMaterialDirty(Graphic graphic) + { + if (graphic) + graphic.SetMaterialDirty(); + } + } +} diff --git a/Scripts/GraphicConnector.cs.meta b/Scripts/GraphicConnector.cs.meta new file mode 100644 index 0000000..403eda2 --- /dev/null +++ b/Scripts/GraphicConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0e702140c28f4425fac896f9394a31b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/MaterialCache.cs b/Scripts/MaterialCache.cs new file mode 100644 index 0000000..055abb2 --- /dev/null +++ b/Scripts/MaterialCache.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using System; +using UnityEngine; +using UnityEngine.UI; + +namespace Coffee.UISoftMask +{ + internal class MaterialCache + { + public delegate void ModifyAction(Material material, Graphic graphic); + + static Dictionary materialMap = new Dictionary(); + + private class MaterialEntry + { + public Material material; + public int referenceCount; + + public void Release() + { + if (material) + { + UnityEngine.Object.DestroyImmediate(material, false); + } + + material = null; + } + } + +#if UNITY_EDITOR + [UnityEditor.InitializeOnLoadMethod] + private static void ClearCache() + { + foreach (var entry in materialMap.Values) + { + entry.Release(); + } + + materialMap.Clear(); + } +#endif + + public static Material Register(Material material, Hash128 hash, Action onModify) + { + if (!hash.isValid) return null; + + MaterialEntry entry; + if (!materialMap.TryGetValue(hash, out entry)) + { + entry = new MaterialEntry() + { + material = new Material(material) + { + hideFlags = HideFlags.HideAndDontSave, + }, + }; + + onModify(entry.material); + materialMap.Add(hash, entry); + } + + entry.referenceCount++; + //Debug.LogFormat("Register: {0}, {1} (Total: {2})", hash, entry.referenceCount, materialMap.Count); + return entry.material; + } + + public static void Unregister(Hash128 hash) + { + MaterialEntry entry; + if (!hash.isValid || !materialMap.TryGetValue(hash, out entry)) return; + //Debug.LogFormat("Unregister: {0}, {1}", hash, entry.referenceCount -1); + + if (--entry.referenceCount > 0) return; + + entry.Release(); + materialMap.Remove(hash); + //Debug.LogFormat("Unregister: Release Emtry: {0}, {1} (Total: {2})", hash, entry.referenceCount, materialMap.Count); + } + } +} diff --git a/Scripts/MaterialCache.cs.meta b/Scripts/MaterialCache.cs.meta new file mode 100644 index 0000000..d519c27 --- /dev/null +++ b/Scripts/MaterialCache.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: be6c8de8d4ec241fdbfad99aca2497d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/SoftMask.cs b/Scripts/SoftMask.cs index ee56b6d..4c38ebb 100644 --- a/Scripts/SoftMask.cs +++ b/Scripts/SoftMask.cs @@ -1,722 +1,714 @@ -using System.Collections; +using System; using System.Collections.Generic; -using System.Reflection; -using System.Text; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UI; +using Object = UnityEngine.Object; -namespace Coffee.UIExtensions +namespace Coffee.UISoftMask { - /// - /// Soft mask. - /// Use instead of Mask for smooth masking. - /// - public class SoftMask : Mask, IMeshModifier - { - //################################ - // Constant or Static Members. - //################################ - /// - /// Desampling rate. - /// - public enum DesamplingRate - { - None = 0, - x1 = 1, - x2 = 2, - x4 = 4, - x8 = 8, - } - - static readonly List[] s_TmpSoftMasks = new List[] - { - new List(), - new List(), - new List(), - new List(), - }; - - static readonly Color[] s_ClearColors = new Color[] - { - new Color(0, 0, 0, 0), - new Color(1, 0, 0, 0), - new Color(1, 1, 0, 0), - new Color(1, 1, 1, 0), - }; - - static bool s_UVStartsAtTop; - - - //################################ - // Serialize Members. - //################################ - [Tooltip("The desampling rate for soft mask buffer.")] - [SerializeField] DesamplingRate m_DesamplingRate = DesamplingRate.None; - [Tooltip("The value used by the soft mask to select the area of influence defined over the soft mask's graphic.")] - [SerializeField][Range(0.01f, 1)] float m_Softness = 1; - [Tooltip("The transparency of the whole masked graphic.")] - [SerializeField][Range(0f, 1f)] float m_Alpha = 1; - [Tooltip("Should the soft mask ignore parent soft masks?")] - [SerializeField] bool m_IgnoreParent = false; - [Tooltip("Is the soft mask a part of parent soft mask?")] - [SerializeField] bool m_PartOfParent = false; - - - //################################ - // Public Members. - //################################ - /// - /// The desampling rate for soft mask buffer. - /// - public DesamplingRate desamplingRate - { - get { return m_DesamplingRate; } - set - { - if (m_DesamplingRate != value) - { - m_DesamplingRate = value; - hasChanged = true; - } - } - } - - /// - /// The value used by the soft mask to select the area of influence defined over the soft mask's graphic. - /// - public float softness - { - get { return m_Softness; } - set - { - value = Mathf.Clamp01(value); - if (m_Softness != value) - { - m_Softness = value; - hasChanged = true; - } - } - } - - /// - /// The transparency of the whole masked graphic. - /// - public float alpha - { - get { return m_Alpha; } - set - { - value = Mathf.Clamp01(value); - if (m_Alpha != value) - { - m_Alpha = value; - hasChanged = true; - } - } - } - - /// - /// Should the soft mask ignore parent soft masks? - /// - /// If set to true the soft mask will ignore any parent soft mask settings. - public bool ignoreParent - { - get { return m_IgnoreParent; } - set - { - if (m_IgnoreParent != value) - { - m_IgnoreParent = value; - hasChanged = true; - OnTransformParentChanged(); - } - } - } - - /// - /// Is the soft mask a part of parent soft mask? - /// - public bool partOfParent - { - get { return m_PartOfParent; } - set - { - if (m_PartOfParent != value) - { - m_PartOfParent = value; - hasChanged = true; - OnTransformParentChanged(); - } - } - } - - /// - /// The soft mask buffer. - /// - public RenderTexture softMaskBuffer - { - get - { - if (_parent) - { - ReleaseRT(ref _softMaskBuffer); - return _parent.softMaskBuffer; - } - - // Check the size of soft mask buffer. - int w, h; - GetDesamplingSize(m_DesamplingRate, out w, out h); - if (_softMaskBuffer && (_softMaskBuffer.width != w || _softMaskBuffer.height != h)) - { - ReleaseRT(ref _softMaskBuffer); - } - - if (!_softMaskBuffer) - { - _softMaskBuffer = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default); - hasChanged = true; - _hasStencilStateChanged = true; - } - - return _softMaskBuffer; - } - } - - public bool hasChanged - { - get - { - return _parent ? _parent.hasChanged : _hasChanged; - } - private set - { - if (_parent) - { - _parent.hasChanged = value; - } - _hasChanged = value; - } - } - - public SoftMask parent - { - get - { - return _parent; - } - } - - - /// - /// Perform material modification in this function. - /// - /// Modified material. - /// Configured Material. - public override Material GetModifiedMaterial(Material baseMaterial) - { - hasChanged = true; - var result = base.GetModifiedMaterial(baseMaterial); - if (m_IgnoreParent && result != baseMaterial) - { - result.SetInt(s_StencilCompId, (int)CompareFunction.Always); - } - return result; - } - - - /// - /// Call used to modify mesh. - /// - void IMeshModifier.ModifyMesh(Mesh mesh) - { - hasChanged = true; - _mesh = mesh; - } - - /// - /// Call used to modify mesh. - /// - void IMeshModifier.ModifyMesh(VertexHelper verts) - { - if (isActiveAndEnabled) - { - verts.FillMesh(mesh); - } - hasChanged = true; - } - - /// - /// Given a point and a camera is the raycast valid. - /// - /// Valid. - /// Screen position. - /// Raycast camera. - /// Target graphic. - public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera, Graphic g, int[] interactions) - { - if (!isActiveAndEnabled || (g == graphic && !g.raycastTarget)) - { - return true; - } - - int x = (int)((softMaskBuffer.width - 1) * Mathf.Clamp01(sp.x / Screen.width)); - int y = s_UVStartsAtTop - ? (int)((softMaskBuffer.height - 1) * (1 - Mathf.Clamp01(sp.y / Screen.height))) - : (int)((softMaskBuffer.height - 1) * Mathf.Clamp01(sp.y / Screen.height)); - return 0.5f < GetPixelValue(x, y, interactions); - } - - public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) - { - return true; - } - - //################################ - // Protected Members. - //################################ - - /// - /// This function is called when the object becomes enabled and active. - /// - protected override void OnEnable() - { - hasChanged = true; - - // Register. - if (s_ActiveSoftMasks.Count == 0) - { - Canvas.willRenderCanvases += UpdateMaskTextures; - - if (s_StencilCompId == 0) - { - s_UVStartsAtTop = SystemInfo.graphicsUVStartsAtTop; - s_StencilCompId = Shader.PropertyToID("_StencilComp"); - s_ColorMaskId = Shader.PropertyToID("_ColorMask"); - s_MainTexId = Shader.PropertyToID("_MainTex"); - s_SoftnessId = Shader.PropertyToID("_Softness"); - s_Alpha = Shader.PropertyToID("_Alpha"); + /// + /// Soft mask. + /// Use instead of Mask for smooth masking. + /// + public class SoftMask : Mask, IMeshModifier + { + /// + /// Desampling rate. + /// + public enum DesamplingRate + { + None = 0, + x1 = 1, + x2 = 2, + x4 = 4, + x8 = 8, + } + + static readonly List[] s_TmpSoftMasks = new List[] + { + new List(), + new List(), + new List(), + new List(), + }; + + static readonly Color[] s_ClearColors = new Color[] + { + new Color(0, 0, 0, 0), + new Color(1, 0, 0, 0), + new Color(1, 1, 0, 0), + new Color(1, 1, 1, 0), + }; + + static bool s_UVStartsAtTop; + + static Shader s_SoftMaskShader; + static Texture2D s_ReadTexture; + static readonly List s_ActiveSoftMasks = new List(); + static readonly List s_TempRelatables = new List(); + static readonly Dictionary s_previousViewProjectionMatrices = new Dictionary(); + static readonly Dictionary s_nowViewProjectionMatrices = new Dictionary(); + static int s_StencilCompId; + static int s_ColorMaskId; + static int s_MainTexId; + static int s_SoftnessId; + static int s_GameVPId; + static int s_GameTVPId; + static int s_Alpha; + MaterialPropertyBlock _mpb; + CommandBuffer _cb; + Material _material; + RenderTexture _softMaskBuffer; + int _stencilDepth; + Mesh _mesh; + SoftMask _parent; + readonly List _children = new List(); + bool _hasChanged = false; + bool _hasStencilStateChanged = false; + + + [Tooltip("The desampling rate for soft mask buffer.")] [SerializeField] + DesamplingRate m_DesamplingRate = DesamplingRate.None; + + [Tooltip( + "The value used by the soft mask to select the area of influence defined over the soft mask's graphic.")] + [SerializeField] + [Range(0.01f, 1)] + float m_Softness = 1; + + [Tooltip("The transparency of the whole masked graphic.")] [SerializeField] [Range(0f, 1f)] + float m_Alpha = 1; + + [Tooltip("Should the soft mask ignore parent soft masks?")] [SerializeField] + bool m_IgnoreParent = false; + + [Tooltip("Is the soft mask a part of parent soft mask?")] [SerializeField] + bool m_PartOfParent = false; + + + /// + /// The desampling rate for soft mask buffer. + /// + public DesamplingRate desamplingRate + { + get { return m_DesamplingRate; } + set + { + if (m_DesamplingRate == value) return; + m_DesamplingRate = value; + hasChanged = true; + } + } + + /// + /// The value used by the soft mask to select the area of influence defined over the soft mask's graphic. + /// + public float softness + { + get { return m_Softness; } + set + { + value = Mathf.Clamp01(value); + if (Mathf.Approximately(m_Softness, value)) return; + m_Softness = value; + hasChanged = true; + } + } + + /// + /// The transparency of the whole masked graphic. + /// + public float alpha + { + get { return m_Alpha; } + set + { + value = Mathf.Clamp01(value); + if (Mathf.Approximately(m_Alpha, value)) return; + m_Alpha = value; + hasChanged = true; + } + } + + /// + /// Should the soft mask ignore parent soft masks? + /// + /// If set to true the soft mask will ignore any parent soft mask settings. + public bool ignoreParent + { + get { return m_IgnoreParent; } + set + { + if (m_IgnoreParent == value) return; + m_IgnoreParent = value; + hasChanged = true; + OnTransformParentChanged(); + } + } + + /// + /// Is the soft mask a part of parent soft mask? + /// + public bool partOfParent + { + get { return m_PartOfParent; } + set + { + if (m_PartOfParent == value) return; + m_PartOfParent = value; + hasChanged = true; + OnTransformParentChanged(); + } + } + + /// + /// The soft mask buffer. + /// + public RenderTexture softMaskBuffer + { + get + { + if (_parent) + { + ReleaseRt(ref _softMaskBuffer); + return _parent.softMaskBuffer; + } + + // Check the size of soft mask buffer. + int w, h; + GetDesamplingSize(m_DesamplingRate, out w, out h); + if (_softMaskBuffer && (_softMaskBuffer.width != w || _softMaskBuffer.height != h)) + { + ReleaseRt(ref _softMaskBuffer); + } + + if (!_softMaskBuffer) + { + _softMaskBuffer = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGB32, + RenderTextureReadWrite.Default); + hasChanged = true; + _hasStencilStateChanged = true; + } + + return _softMaskBuffer; + } + } + + public bool hasChanged + { + get { return _parent ? _parent.hasChanged : _hasChanged; } + private set + { + if (_parent) + { + _parent.hasChanged = value; + } + + _hasChanged = value; + } + } + + public SoftMask parent + { + get { return _parent; } + } + + Material material + { + get + { + return _material + ? _material + : _material = + new Material(s_SoftMaskShader + ? s_SoftMaskShader + : s_SoftMaskShader = Resources.Load("SoftMask")) + {hideFlags = HideFlags.HideAndDontSave}; + } + } + + Mesh mesh + { + get { return _mesh ? _mesh : _mesh = new Mesh() {hideFlags = HideFlags.HideAndDontSave}; } + } + + + /// + /// Perform material modification in this function. + /// + /// Modified material. + /// Configured Material. + public override Material GetModifiedMaterial(Material baseMaterial) + { + hasChanged = true; + var result = base.GetModifiedMaterial(baseMaterial); + if (m_IgnoreParent && result != baseMaterial) + { + result.SetInt(s_StencilCompId, (int) CompareFunction.Always); + } + + return result; + } + + + /// + /// Call used to modify mesh. + /// + void IMeshModifier.ModifyMesh(Mesh mesh) + { + hasChanged = true; + _mesh = mesh; + } + + /// + /// Call used to modify mesh. + /// + void IMeshModifier.ModifyMesh(VertexHelper verts) + { + if (isActiveAndEnabled) + verts.FillMesh(mesh); + hasChanged = true; + } + + /// + /// Given a point and a camera is the raycast valid. + /// + /// Valid. + /// Screen position. + /// Raycast camera. + /// Target graphic. + public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera, Graphic g, int[] interactions) + { + if (!isActiveAndEnabled || (g == graphic && !g.raycastTarget)) return true; + + int x = (int) ((softMaskBuffer.width - 1) * Mathf.Clamp01(sp.x / Screen.width)); + int y = s_UVStartsAtTop + ? (int) ((softMaskBuffer.height - 1) * (1 - Mathf.Clamp01(sp.y / Screen.height))) + : (int) ((softMaskBuffer.height - 1) * Mathf.Clamp01(sp.y / Screen.height)); + return 0.5f < GetPixelValue(x, y, interactions); + } + + public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) + { + return true; + } + + /// + /// This function is called when the object becomes enabled and active. + /// + protected override void OnEnable() + { + hasChanged = true; + + // Register. + if (s_ActiveSoftMasks.Count == 0) + { + Canvas.willRenderCanvases += UpdateMaskTextures; + + if (s_StencilCompId == 0) + { + s_UVStartsAtTop = SystemInfo.graphicsUVStartsAtTop; + s_StencilCompId = Shader.PropertyToID("_StencilComp"); + s_ColorMaskId = Shader.PropertyToID("_ColorMask"); + s_MainTexId = Shader.PropertyToID("_MainTex"); + s_SoftnessId = Shader.PropertyToID("_Softness"); + s_Alpha = Shader.PropertyToID("_Alpha"); #if UNITY_EDITOR - s_GameVPId = Shader.PropertyToID("_GameVP"); - s_GameTVPId = Shader.PropertyToID("_GameTVP"); + s_GameVPId = Shader.PropertyToID("_GameVP"); + s_GameTVPId = Shader.PropertyToID("_GameTVP"); #endif - } - } - s_ActiveSoftMasks.Add(this); - - // Reset the parent-child relation. - GetComponentsInChildren(false, s_TempRelatables); - for (int i = s_TempRelatables.Count - 1; 0 <= i; i--) - { - s_TempRelatables[i].OnTransformParentChanged(); - } - s_TempRelatables.Clear(); - - // Create objects. - _mpb = new MaterialPropertyBlock(); - _cb = new CommandBuffer(); - - graphic.SetVerticesDirty(); - - base.OnEnable(); - _hasStencilStateChanged = false; - } - - /// - /// This function is called when the behaviour becomes disabled. - /// - protected override void OnDisable() - { - // Unregister. - s_ActiveSoftMasks.Remove(this); - if (s_ActiveSoftMasks.Count == 0) - { - Canvas.willRenderCanvases -= UpdateMaskTextures; - } - - // Reset the parent-child relation. - for (int i = _children.Count - 1; 0 <= i; i--) - { - _children[i].SetParent(_parent); - } - _children.Clear(); - SetParent(null); - - // Destroy objects. - _mpb.Clear(); - _mpb = null; - _cb.Release(); - _cb = null; - - ReleaseObject(_mesh); - _mesh = null; - ReleaseObject(_material); - _material = null; - ReleaseRT(ref _softMaskBuffer); - - base.OnDisable(); - _hasStencilStateChanged = false; - } - - /// - /// This function is called when the parent property of the transform of the GameObject has changed. - /// - protected override void OnTransformParentChanged() - { - hasChanged = true; - SoftMask newParent = null; - if (isActiveAndEnabled && !m_IgnoreParent) - { - var parentTransform = transform.parent; - while (parentTransform && (!newParent || !newParent.enabled)) - { - newParent = parentTransform.GetComponent(); - parentTransform = parentTransform.parent; - } - } - SetParent(newParent); - hasChanged = true; - } - - protected override void OnRectTransformDimensionsChange() - { - hasChanged = true; - } + } + } + + s_ActiveSoftMasks.Add(this); + + // Reset the parent-child relation. + GetComponentsInChildren(false, s_TempRelatables); + for (int i = s_TempRelatables.Count - 1; 0 <= i; i--) + { + s_TempRelatables[i].OnTransformParentChanged(); + } + + s_TempRelatables.Clear(); + + // Create objects. + _mpb = new MaterialPropertyBlock(); + _cb = new CommandBuffer(); + + graphic.SetVerticesDirty(); + + base.OnEnable(); + _hasStencilStateChanged = false; + } + + /// + /// This function is called when the behaviour becomes disabled. + /// + protected override void OnDisable() + { + // Unregister. + s_ActiveSoftMasks.Remove(this); + if (s_ActiveSoftMasks.Count == 0) + { + Canvas.willRenderCanvases -= UpdateMaskTextures; + } + + // Reset the parent-child relation. + for (int i = _children.Count - 1; 0 <= i; i--) + { + _children[i].SetParent(_parent); + } + + _children.Clear(); + SetParent(null); + + // Destroy objects. + _mpb.Clear(); + _mpb = null; + _cb.Release(); + _cb = null; + + ReleaseObject(_mesh); + _mesh = null; + ReleaseObject(_material); + _material = null; + ReleaseRt(ref _softMaskBuffer); + + base.OnDisable(); + _hasStencilStateChanged = false; + } + + /// + /// This function is called when the parent property of the transform of the GameObject has changed. + /// + protected override void OnTransformParentChanged() + { + hasChanged = true; + SoftMask newParent = null; + if (isActiveAndEnabled && !m_IgnoreParent) + { + var parentTransform = transform.parent; + while (parentTransform && (!newParent || !newParent.enabled)) + { + newParent = parentTransform.GetComponent(); + parentTransform = parentTransform.parent; + } + } + + SetParent(newParent); + hasChanged = true; + } + + protected override void OnRectTransformDimensionsChange() + { + hasChanged = true; + } #if UNITY_EDITOR - /// - /// Update the scene view matrix for shader. - /// - - /// - /// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only). - /// - protected override void OnValidate() - { - graphic.SetMaterialDirty(); - OnTransformParentChanged(); - base.OnValidate(); - _hasStencilStateChanged = false; - } + /// + /// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only). + /// + protected override void OnValidate() + { + graphic.SetMaterialDirty(); + OnTransformParentChanged(); + base.OnValidate(); + _hasStencilStateChanged = false; + } #endif - //################################ - // Private Members. - //################################ - static Shader s_SoftMaskShader; - static Texture2D s_ReadTexture; - static List s_ActiveSoftMasks = new List(); - static List s_TempRelatables = new List(); - static int s_StencilCompId; - static int s_ColorMaskId; - static int s_MainTexId; - static int s_SoftnessId; - static int s_GameVPId; - static int s_GameTVPId; - static int s_Alpha; - MaterialPropertyBlock _mpb; - CommandBuffer _cb; - Material _material; - RenderTexture _softMaskBuffer; - int _stencilDepth; - Mesh _mesh; - SoftMask _parent; - List _children = new List(); - bool _hasChanged = false; - bool _hasStencilStateChanged = false; - static readonly Dictionary s_previousViewProjectionMatrices = new Dictionary (); - static readonly Dictionary s_nowViewProjectionMatrices = new Dictionary (); - - Material material { get { return _material ? _material : _material = new Material(s_SoftMaskShader ? s_SoftMaskShader : s_SoftMaskShader = Resources.Load("SoftMask")){ hideFlags = HideFlags.HideAndDontSave }; } } - - Mesh mesh { get { return _mesh ? _mesh : _mesh = new Mesh(){ hideFlags = HideFlags.HideAndDontSave }; } } - - /// - /// Update all soft mask textures. - /// - static void UpdateMaskTextures() - { - foreach (var sm in s_ActiveSoftMasks) - { - if (!sm || sm._hasChanged) - continue; - - var canvas = sm.graphic.canvas; - if(!canvas) - continue; - - if (canvas.renderMode == RenderMode.WorldSpace) - { - var cam = canvas.worldCamera; - if(!cam) - continue; - - Matrix4x4 nowVP = cam.projectionMatrix * cam.worldToCameraMatrix; - - Matrix4x4 previousVP = default(Matrix4x4); - int id = cam.GetInstanceID (); - s_previousViewProjectionMatrices.TryGetValue (id, out previousVP); - s_nowViewProjectionMatrices[id] = nowVP; - - if (previousVP != nowVP) - { - sm.hasChanged = true; - } - } - - var rt = sm.rectTransform; - if (rt.hasChanged) - { - rt.hasChanged = false; - sm.hasChanged = true; - } + /// + /// Update all soft mask textures. + /// + static void UpdateMaskTextures() + { + foreach (var sm in s_ActiveSoftMasks) + { + if (!sm || sm._hasChanged) + continue; + + var canvas = sm.graphic.canvas; + if (!canvas) + continue; + + if (canvas.renderMode == RenderMode.WorldSpace) + { + var cam = canvas.worldCamera; + if (!cam) + continue; + + var nowVP = cam.projectionMatrix * cam.worldToCameraMatrix; + var previousVP = default(Matrix4x4); + var id = cam.GetInstanceID(); + s_previousViewProjectionMatrices.TryGetValue(id, out previousVP); + s_nowViewProjectionMatrices[id] = nowVP; + + if (previousVP != nowVP) + { + sm.hasChanged = true; + } + } + + var rt = sm.rectTransform; + if (rt.hasChanged) + { + rt.hasChanged = false; + sm.hasChanged = true; + } #if UNITY_EDITOR - if (!Application.isPlaying) - { - sm.hasChanged = true; - } + if (!Application.isPlaying) + { + sm.hasChanged = true; + } #endif - } - - foreach (var sm in s_ActiveSoftMasks) - { - if (!sm || !sm._hasChanged) - continue; - - sm._hasChanged = false; - if (!sm._parent) - { - sm.UpdateMaskTexture(); - if (sm._hasStencilStateChanged) - { - sm._hasStencilStateChanged = false; - MaskUtilities.NotifyStencilStateChanged (sm); - } - } - } - - s_previousViewProjectionMatrices.Clear (); - foreach (int id in s_nowViewProjectionMatrices.Keys) - { - s_previousViewProjectionMatrices [id] = s_nowViewProjectionMatrices [id]; - } - s_nowViewProjectionMatrices.Clear (); - - } - - /// - /// Update the mask texture. - /// - void UpdateMaskTexture() - { - if (!graphic || !graphic.canvas) - { - return; - } - - _stencilDepth = MaskUtilities.GetStencilDepth(transform, MaskUtilities.FindRootSortOverrideCanvas(transform)); - - // Collect children soft masks. - int depth = 0; - s_TmpSoftMasks[0].Add(this); - while (_stencilDepth + depth < 3) - { - int count = s_TmpSoftMasks[depth].Count; - for (int i = 0; i < count; i++) - { - List children = s_TmpSoftMasks[depth][i]._children; - int childCount = children.Count; - for (int j = 0; j < childCount; j++) - { - var child = children[j]; - var childDepth = child.m_PartOfParent ? depth : depth + 1; - s_TmpSoftMasks[childDepth].Add(child); - } - } - depth++; - } - - // Clear. - _cb.Clear(); - _cb.SetRenderTarget(softMaskBuffer); - _cb.ClearRenderTarget(false, true, s_ClearColors[_stencilDepth]); - - // Set view and projection matrices. - var c = graphic.canvas.rootCanvas; - var cam = c.worldCamera ?? Camera.main; - if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && cam) - { - _cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, GL.GetGPUProjectionMatrix(cam.projectionMatrix, false)); + } + + foreach (var sm in s_ActiveSoftMasks) + { + if (!sm || !sm._hasChanged) + continue; + + sm._hasChanged = false; + if (sm._parent) continue; + sm.UpdateMaskTexture(); + + if (!sm._hasStencilStateChanged) continue; + sm._hasStencilStateChanged = false; + MaskUtilities.NotifyStencilStateChanged(sm); + } + + s_previousViewProjectionMatrices.Clear(); + foreach (var id in s_nowViewProjectionMatrices.Keys) + { + s_previousViewProjectionMatrices[id] = s_nowViewProjectionMatrices[id]; + } + + s_nowViewProjectionMatrices.Clear(); + } + + /// + /// Update the mask texture. + /// + private void UpdateMaskTexture() + { + if (!graphic || !graphic.canvas) return; + + _stencilDepth = + MaskUtilities.GetStencilDepth(transform, MaskUtilities.FindRootSortOverrideCanvas(transform)); + + // Collect children soft masks. + var depth = 0; + s_TmpSoftMasks[0].Add(this); + while (_stencilDepth + depth < 3) + { + var count = s_TmpSoftMasks[depth].Count; + for (var i = 0; i < count; i++) + { + List children = s_TmpSoftMasks[depth][i]._children; + var childCount = children.Count; + for (var j = 0; j < childCount; j++) + { + var child = children[j]; + var childDepth = child.m_PartOfParent ? depth : depth + 1; + s_TmpSoftMasks[childDepth].Add(child); + } + } + + depth++; + } + + // Clear. + _cb.Clear(); + _cb.SetRenderTarget(softMaskBuffer); + _cb.ClearRenderTarget(false, true, s_ClearColors[_stencilDepth]); + + // Set view and projection matrices. + var c = graphic.canvas.rootCanvas; + var cam = c.worldCamera ?? Camera.main; + if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && cam) + { + _cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, + GL.GetGPUProjectionMatrix(cam.projectionMatrix, false)); #if UNITY_EDITOR - var pv = GL.GetGPUProjectionMatrix(cam.projectionMatrix, false) * cam.worldToCameraMatrix; - _cb.SetGlobalMatrix(s_GameVPId, pv); - _cb.SetGlobalMatrix(s_GameTVPId, pv); + var pv = GL.GetGPUProjectionMatrix(cam.projectionMatrix, false) * cam.worldToCameraMatrix; + _cb.SetGlobalMatrix(s_GameVPId, pv); + _cb.SetGlobalMatrix(s_GameTVPId, pv); #endif - } - else - { - var pos = c.transform.position; - var vm = Matrix4x4.TRS(new Vector3(-pos.x, -pos.y, -1000), Quaternion.identity, new Vector3(1, 1, -1f)); - var pm = Matrix4x4.TRS(new Vector3(0, 0, -1), Quaternion.identity, new Vector3(1 / pos.x, 1 / pos.y, -2 / 10000f)); - _cb.SetViewProjectionMatrices(vm, pm); + } + else + { + var pos = c.transform.position; + var vm = Matrix4x4.TRS(new Vector3(-pos.x, -pos.y, -1000), Quaternion.identity, new Vector3(1, 1, -1f)); + var pm = Matrix4x4.TRS(new Vector3(0, 0, -1), Quaternion.identity, + new Vector3(1 / pos.x, 1 / pos.y, -2 / 10000f)); + _cb.SetViewProjectionMatrices(vm, pm); #if UNITY_EDITOR - var scale = c.transform.localScale.x; - var size = (c.transform as RectTransform).sizeDelta; - _cb.SetGlobalMatrix(s_GameVPId, Matrix4x4.TRS(new Vector3(0, 0, 0.5f), Quaternion.identity, new Vector3(2 / size.x, 2 / size.y, 0.0005f * scale))); - _cb.SetGlobalMatrix(s_GameTVPId, Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, new Vector3(1 / pos.x, 1 / pos.y, -2 / 2000f)) * Matrix4x4.Translate(-pos)); + var scale = c.transform.localScale.x; + var size = (c.transform as RectTransform).sizeDelta; + _cb.SetGlobalMatrix(s_GameVPId, + Matrix4x4.TRS(new Vector3(0, 0, 0.5f), Quaternion.identity, + new Vector3(2 / size.x, 2 / size.y, 0.0005f * scale))); + _cb.SetGlobalMatrix(s_GameTVPId, + Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, + new Vector3(1 / pos.x, 1 / pos.y, -2 / 2000f)) * Matrix4x4.Translate(-pos)); #endif - } - - // Draw soft masks. - for (int i = 0; i < s_TmpSoftMasks.Length; i++) - { - int count = s_TmpSoftMasks[i].Count; - for (int j = 0; j < count; j++) - { - var sm = s_TmpSoftMasks[i][j]; - - if (i != 0) - { - sm._stencilDepth = MaskUtilities.GetStencilDepth(sm.transform, MaskUtilities.FindRootSortOverrideCanvas(sm.transform)); - } - - // Set material property. - sm.material.SetInt(s_ColorMaskId, (int)1 << (3 - _stencilDepth - i)); - sm._mpb.SetTexture(s_MainTexId, sm.graphic.mainTexture); - sm._mpb.SetFloat(s_SoftnessId, sm.m_Softness); - sm._mpb.SetFloat(s_Alpha, sm.m_Alpha); - - // Draw mesh. - _cb.DrawMesh(sm.mesh, sm.transform.localToWorldMatrix, sm.material, 0, 0, sm._mpb); - } - s_TmpSoftMasks[i].Clear(); - } - - Graphics.ExecuteCommandBuffer(_cb); - } - - /// - /// Gets the size of the desampling. - /// - void GetDesamplingSize(DesamplingRate rate, out int w, out int h) - { + } + + // Draw soft masks. + for (var i = 0; i < s_TmpSoftMasks.Length; i++) + { + var count = s_TmpSoftMasks[i].Count; + for (var j = 0; j < count; j++) + { + var sm = s_TmpSoftMasks[i][j]; + + if (i != 0) + { + sm._stencilDepth = MaskUtilities.GetStencilDepth(sm.transform, + MaskUtilities.FindRootSortOverrideCanvas(sm.transform)); + } + + // Set material property. + sm.material.SetInt(s_ColorMaskId, (int) 1 << (3 - _stencilDepth - i)); + sm._mpb.SetTexture(s_MainTexId, sm.graphic.mainTexture); + sm._mpb.SetFloat(s_SoftnessId, sm.m_Softness); + sm._mpb.SetFloat(s_Alpha, sm.m_Alpha); + + // Draw mesh. + _cb.DrawMesh(sm.mesh, sm.transform.localToWorldMatrix, sm.material, 0, 0, sm._mpb); + } + + s_TmpSoftMasks[i].Clear(); + } + + Graphics.ExecuteCommandBuffer(_cb); + } + + /// + /// Gets the size of the desampling. + /// + private static void GetDesamplingSize(DesamplingRate rate, out int w, out int h) + { #if UNITY_EDITOR - var res = UnityEditor.UnityStats.screenRes.Split('x'); - w = int.Parse(res[0]); - h = int.Parse(res[1]); + var res = UnityEditor.UnityStats.screenRes.Split('x'); + w = int.Parse(res[0]); + h = int.Parse(res[1]); #else w = Screen.width; h = Screen.height; #endif - if (rate == DesamplingRate.None) - return; - - float aspect = (float)w / h; - if (w < h) - { - h = Mathf.ClosestPowerOfTwo(h / (int)rate); - w = Mathf.CeilToInt(h * aspect); - } - else - { - w = Mathf.ClosestPowerOfTwo(w / (int)rate); - h = Mathf.CeilToInt(w / aspect); - } - } - - /// - /// Release the specified obj. - /// - /// Object. - void ReleaseRT(ref RenderTexture tmpRT) - { - if (tmpRT) - { - tmpRT.Release(); - RenderTexture.ReleaseTemporary(tmpRT); - tmpRT = null; - } - } - - /// - /// Release the specified obj. - /// - /// Object. - void ReleaseObject(Object obj) - { - if (obj) - { - #if UNITY_EDITOR - if (!Application.isPlaying) - DestroyImmediate(obj); - else - #endif - Destroy(obj); - obj = null; - } - } - - - /// - /// Set the parent of the soft mask. - /// - /// The parent soft mask to use. - void SetParent(SoftMask newParent) - { - if (_parent != newParent && this != newParent) - { - if (_parent && _parent._children.Contains(this)) - { - _parent._children.Remove(this); - _parent._children.RemoveAll(x => x == null); - } - _parent = newParent; - } - - if (_parent && !_parent._children.Contains(this)) - { - _parent._children.Add(this); - } - } - - /// - /// Gets the pixel value. - /// - float GetPixelValue(int x, int y, int[] interactions) - { - if (!s_ReadTexture) - { - s_ReadTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); - } - var currentRT = RenderTexture.active; - - RenderTexture.active = softMaskBuffer; - s_ReadTexture.ReadPixels(new Rect(x, y, 1, 1), 0, 0); - s_ReadTexture.Apply(false, false); - RenderTexture.active = currentRT; - - var colors = s_ReadTexture.GetRawTextureData(); - - for (int i = 0; i < 4; i++) - { - switch (interactions[(i + 3)%4]) - { - case 0: colors[i] = 255; break; - case 2: colors[i] = (byte)(255 - colors[i]); break; - } - } - - switch (_stencilDepth) - { - case 0: return (colors[1] / 255f); - case 1: return (colors[1] / 255f) * (colors[2] / 255f); - case 2: return (colors[1] / 255f) * (colors[2] / 255f) * (colors[3] / 255f); - case 3: return (colors[1] / 255f) * (colors[2] / 255f) * (colors[3] / 255f) * (colors[0] / 255f); - default: return 0; - } - } - } + if (rate == DesamplingRate.None) + return; + + var aspect = (float) w / h; + if (w < h) + { + h = Mathf.ClosestPowerOfTwo(h / (int) rate); + w = Mathf.CeilToInt(h * aspect); + } + else + { + w = Mathf.ClosestPowerOfTwo(w / (int) rate); + h = Mathf.CeilToInt(w / aspect); + } + } + + /// + /// Release the specified obj. + /// + /// Object. + private static void ReleaseRt(ref RenderTexture tmpRT) + { + if (!tmpRT) return; + tmpRT.Release(); + RenderTexture.ReleaseTemporary(tmpRT); + tmpRT = null; + } + + /// + /// Release the specified obj. + /// + /// Object. + private static void ReleaseObject(Object obj) + { + if (!obj) return; +#if UNITY_EDITOR + if (!Application.isPlaying) + DestroyImmediate(obj); + else +#endif + Destroy(obj); + obj = null; + } + + + /// + /// Set the parent of the soft mask. + /// + /// The parent soft mask to use. + private void SetParent(SoftMask newParent) + { + if (_parent != newParent && this != newParent) + { + if (_parent && _parent._children.Contains(this)) + { + _parent._children.Remove(this); + _parent._children.RemoveAll(x => x == null); + } + + _parent = newParent; + } + + if (_parent && !_parent._children.Contains(this)) + { + _parent._children.Add(this); + } + } + + /// + /// Gets the pixel value. + /// + private float GetPixelValue(int x, int y, int[] interactions) + { + if (!s_ReadTexture) + { + s_ReadTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); + } + + var currentRt = RenderTexture.active; + + RenderTexture.active = softMaskBuffer; + s_ReadTexture.ReadPixels(new Rect(x, y, 1, 1), 0, 0); + s_ReadTexture.Apply(false, false); + RenderTexture.active = currentRt; + + var colors = s_ReadTexture.GetRawTextureData(); + + for (int i = 0; i < 4; i++) + { + switch (interactions[(i + 3) % 4]) + { + case 0: + colors[i] = 255; + break; + case 2: + colors[i] = (byte) (255 - colors[i]); + break; + } + } + + switch (_stencilDepth) + { + case 0: return (colors[1] / 255f); + case 1: return (colors[1] / 255f) * (colors[2] / 255f); + case 2: return (colors[1] / 255f) * (colors[2] / 255f) * (colors[3] / 255f); + case 3: return (colors[1] / 255f) * (colors[2] / 255f) * (colors[3] / 255f) * (colors[0] / 255f); + default: return 0; + } + } + } } diff --git a/Scripts/SoftMaskable.cs b/Scripts/SoftMaskable.cs index b391c8c..9c5ad2a 100755 --- a/Scripts/SoftMaskable.cs +++ b/Scripts/SoftMaskable.cs @@ -1,301 +1,263 @@ -using System.Collections; -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UI; using MaskIntr = UnityEngine.SpriteMaskInteraction; -using UnityEngine.Serialization; -namespace Coffee.UIExtensions +namespace Coffee.UISoftMask { - /// - /// Soft maskable. - /// Add this component to Graphic under SoftMask for smooth masking. - /// + /// + /// Soft maskable. + /// Add this component to Graphic under SoftMask for smooth masking. + /// #if UNITY_2018_3_OR_NEWER - [ExecuteAlways] + [ExecuteAlways] #else [ExecuteInEditMode] # endif - public class SoftMaskable : MonoBehaviour, IMaterialModifier, ICanvasRaycastFilter, ISerializationCallbackReceiver - { - //################################ - // Constant or Static Members. - //################################ - const int kVisibleInside = (1 << 0) + (1 << 2) + (1 << 4) + (1 << 6); - const int kVisibleOutside = (2 << 0) + (2 << 2) + (2 << 4) + (2 << 6); - - - //################################ - // Serialize Members. - //################################ - [Tooltip("The graphic will be visible only in areas where no mask is present.")] - [System.Obsolete] - [HideInInspector] - [SerializeField] bool m_Inverse = false; - [Tooltip("The interaction for each masks.")] - [HideInInspector] - [SerializeField] int m_MaskInteraction = kVisibleInside; - [Tooltip("Use stencil to mask.")] - [SerializeField] bool m_UseStencil = false; - [Tooltip("Use soft-masked raycast target.\n\nNote: This option is expensive.")] - [SerializeField] bool m_RaycastFilter = false; - - - //################################ - // Public Members. - //################################ - /// - /// Perform material modification in this function. - /// - /// Modified material. - /// Configured Material. - public Material GetModifiedMaterial(Material baseMaterial) - { - _softMask = null; - if (!isActiveAndEnabled) - { - return baseMaterial; - } - - // Find the nearest parent softmask. - var parentTransform = transform.parent; - while (parentTransform) - { - var sm = parentTransform.GetComponent(); - if (sm && sm.enabled) - { - _softMask = sm; - break; - } - parentTransform = parentTransform.parent; - } - - Material result = baseMaterial; - if (_softMask) - { - result = new Material(baseMaterial); - result.hideFlags = HideFlags.HideAndDontSave; - result.SetTexture(s_SoftMaskTexId, _softMask.softMaskBuffer); - result.SetInt(s_StencilCompId, m_UseStencil ? (int)CompareFunction.Equal : (int)CompareFunction.Always); - result.SetVector(s_MaskInteractionId, new Vector4( - (m_MaskInteraction & 0x3), - ((m_MaskInteraction >> 2) & 0x3), - ((m_MaskInteraction >> 4) & 0x3), - ((m_MaskInteraction >> 6) & 0x3) - )); - - StencilMaterial.Remove(baseMaterial); - ReleaseMaterial(ref _maskMaterial); - _maskMaterial = result; - - #if UNITY_EDITOR - result.EnableKeyword("SOFTMASK_EDITOR"); - #endif - } - else - { - baseMaterial.SetTexture(s_SoftMaskTexId, Texture2D.whiteTexture); - } - - return result; - } - - /// - /// Given a point and a camera is the raycast valid. - /// - /// Valid. - /// Screen position. - /// Raycast camera. - public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) - { - if (!isActiveAndEnabled || !_softMask) - return true; - - if (!RectTransformUtility.RectangleContainsScreenPoint(transform as RectTransform, sp, eventCamera)) - { - return false; - } - else if (!m_RaycastFilter) + public class SoftMaskable : MonoBehaviour, IMaterialModifier, ICanvasRaycastFilter +#if UNITY_EDITOR + , ISerializationCallbackReceiver +# endif + { + const int kVisibleInside = (1 << 0) + (1 << 2) + (1 << 4) + (1 << 6); + const int kVisibleOutside = (2 << 0) + (2 << 2) + (2 << 4) + (2 << 6); + static readonly Hash128 k_InvalidHash = new Hash128(); + + static int s_SoftMaskTexId; + static int s_StencilCompId; + static int s_MaskInteractionId; + static List s_ActiveSoftMaskables; + static int[] s_Interactions = new int[4]; + + [Tooltip("The graphic will be visible only in areas where no mask is present.")] + [System.Obsolete] + [HideInInspector] + [SerializeField] + bool m_Inverse = false; + + [Tooltip("The interaction for each masks.")] [HideInInspector] [SerializeField] + int m_MaskInteraction = kVisibleInside; + + [Tooltip("Use stencil to mask.")] [SerializeField] + bool m_UseStencil = false; + + [Tooltip("Use soft-masked raycast target.\n\nNote: This option is expensive.")] [SerializeField] + bool m_RaycastFilter = false; + + Graphic _graphic = null; + SoftMask _softMask = null; + Material _maskMaterial = null; + Hash128 _effectMaterialHash; + + /// + /// The graphic will be visible only in areas where no mask is present. + /// + public bool inverse + { + get { return m_MaskInteraction == kVisibleOutside; } + set + { + var intValue = value ? kVisibleOutside : kVisibleInside; + if (m_MaskInteraction == intValue) return; + m_MaskInteraction = intValue; + graphic.SetMaterialDirtyEx(); + } + } + + /// + /// Use soft-masked raycast target. This option is expensive. + /// + public bool raycastFilter + { + get { return m_RaycastFilter; } + set { m_RaycastFilter = value; } + } + + /// + /// The graphic associated with the soft mask. + /// + public Graphic graphic + { + get { return _graphic ? _graphic : _graphic = GetComponent(); } + } + + /// + /// Perform material modification in this function. + /// + /// Modified material. + /// Configured Material. + Material IMaterialModifier.GetModifiedMaterial(Material baseMaterial) + { + _softMask = null; + + // Unregister the previous material + MaterialCache.Unregister(_effectMaterialHash); + _effectMaterialHash = k_InvalidHash; + + // If this component is disabled, the material is returned as is. + if (!isActiveAndEnabled) return baseMaterial; + + // Find the nearest parent softmask. + var parentTransform = transform.parent; + while (parentTransform) { - return true; + var sm = parentTransform.GetComponent(); + if (sm && sm.enabled) + { + _softMask = sm; + break; + } + + parentTransform = parentTransform.parent; } - var sm = _softMask; - for (int i = 0; i < 4; i++) - { - s_Interactions[i] = sm ? ((m_MaskInteraction >> i * 2) & 0x3) : 0; - sm = sm ? sm.parent : null; - } - - return _softMask.IsRaycastLocationValid(sp, eventCamera, graphic, s_Interactions); - } - - - /// - /// The graphic will be visible only in areas where no mask is present. - /// - public bool inverse - { - get { return m_MaskInteraction == kVisibleOutside; } - set - { - int intValue = value ? kVisibleOutside : kVisibleInside; - if (m_MaskInteraction != intValue) - { - m_MaskInteraction = intValue; - graphic.SetMaterialDirty(); - } - } - } - - /// - /// Use soft-masked raycast target. This option is expensive. - /// - public bool raycastFilter - { - get { return m_RaycastFilter; } - set { m_RaycastFilter = value; } - } - - /// - /// The graphic associated with the soft mask. - /// - public Graphic graphic{ get { return _graphic ? _graphic : _graphic = GetComponent(); } } - - /// - /// Set the interaction for each mask. - /// - public void SetMaskInteraction(SpriteMaskInteraction intr) - { - SetMaskInteraction(intr, intr, intr, intr); - } - - /// - /// Set the interaction for each mask. - /// - public void SetMaskInteraction(SpriteMaskInteraction layer0, SpriteMaskInteraction layer1, SpriteMaskInteraction layer2, SpriteMaskInteraction layer3) - { - m_MaskInteraction = (int)layer0 + ((int)layer1 << 2) + ((int)layer2 << 4) + ((int)layer3 << 6); - if (graphic) - { - graphic.SetMaterialDirty(); - } - } - - //################################ - // Private Members. - //################################ - Graphic _graphic = null; - SoftMask _softMask = null; - Material _maskMaterial = null; - static int s_SoftMaskTexId; - static int s_StencilCompId; - static int s_MaskInteractionId; - static List s_ActiveSoftMaskables; - static int[] s_Interactions = new int[4]; - static Material s_DefaultMaterial; + // If the parents do not have a soft mask component, the material is returned as is. + if (!_softMask) return baseMaterial; + + // Generate soft maskable material. + _effectMaterialHash = new Hash128( + (uint) baseMaterial.GetInstanceID(), + (uint) _softMask.GetInstanceID(), + (uint) m_MaskInteraction, + (uint) (m_UseStencil ? 1 : 0) + ); + // Generate soft maskable material. + var modifiedMaterial = MaterialCache.Register(baseMaterial, _effectMaterialHash, mat => + { + mat.shader = Shader.Find(string.Format("Hidden/{0} (SoftMaskable)", mat.shader.name)); #if UNITY_EDITOR - /// - /// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only). - /// - void OnValidate() - { - if (graphic) - { - graphic.SetMaterialDirty(); - } - } + mat.EnableKeyword("SOFTMASK_EDITOR"); #endif + mat.SetTexture(s_SoftMaskTexId, _softMask.softMaskBuffer); + mat.SetInt(s_StencilCompId, + m_UseStencil ? (int) CompareFunction.Equal : (int) CompareFunction.Always); + mat.SetVector(s_MaskInteractionId, new Vector4( + (m_MaskInteraction & 0x3), + ((m_MaskInteraction >> 2) & 0x3), + ((m_MaskInteraction >> 4) & 0x3), + ((m_MaskInteraction >> 6) & 0x3) + )); + }); + _maskMaterial = modifiedMaterial; + + return modifiedMaterial; + } + + /// + /// Given a point and a camera is the raycast valid. + /// + /// Valid. + /// Screen position. + /// Raycast camera. + bool ICanvasRaycastFilter.IsRaycastLocationValid(Vector2 sp, Camera eventCamera) + { + if (!isActiveAndEnabled || !_softMask) + return true; + if (!RectTransformUtility.RectangleContainsScreenPoint(transform as RectTransform, sp, eventCamera)) + return false; + if (!m_RaycastFilter) + return true; + + var sm = _softMask; + for (var i = 0; i < 4; i++) + { + s_Interactions[i] = sm ? ((m_MaskInteraction >> i * 2) & 0x3) : 0; + sm = sm ? sm.parent : null; + } + + return _softMask.IsRaycastLocationValid(sp, eventCamera, graphic, s_Interactions); + } + + /// + /// Set the interaction for each mask. + /// + public void SetMaskInteraction(SpriteMaskInteraction intr) + { + SetMaskInteraction(intr, intr, intr, intr); + } + + /// + /// Set the interaction for each mask. + /// + public void SetMaskInteraction(SpriteMaskInteraction layer0, SpriteMaskInteraction layer1, + SpriteMaskInteraction layer2, SpriteMaskInteraction layer3) + { + m_MaskInteraction = (int) layer0 + ((int) layer1 << 2) + ((int) layer2 << 4) + ((int) layer3 << 6); + graphic.SetMaterialDirtyEx(); + } + + + /// + /// This function is called when the object becomes enabled and active. + /// + private void OnEnable() + { + // Register. + if (s_ActiveSoftMaskables == null) + { + s_ActiveSoftMaskables = new List(); + + s_SoftMaskTexId = Shader.PropertyToID("_SoftMaskTex"); + s_StencilCompId = Shader.PropertyToID("_StencilComp"); + s_MaskInteractionId = Shader.PropertyToID("_MaskInteraction"); + } - /// - /// This function is called when the object becomes enabled and active. - /// - void OnEnable() - { - // Register. - if (s_ActiveSoftMaskables == null) - { - s_ActiveSoftMaskables = new List(); - - s_SoftMaskTexId = Shader.PropertyToID("_SoftMaskTex"); - s_StencilCompId = Shader.PropertyToID("_StencilComp"); - s_MaskInteractionId = Shader.PropertyToID("_MaskInteraction"); - } - s_ActiveSoftMaskables.Add(this); - - - var g = graphic; - if (g) - { - if (!g.material || g.material == Graphic.defaultGraphicMaterial) - { - g.material = s_DefaultMaterial ?? (s_DefaultMaterial = new Material(Resources.Load("UI-Default-SoftMask")) { hideFlags = HideFlags.HideAndDontSave, }); - } - g.SetMaterialDirty(); - } - _softMask = null; - } - - /// - /// This function is called when the behaviour becomes disabled. - /// - void OnDisable() - { - s_ActiveSoftMaskables.Remove(this); - - var g = graphic; - if (g) - { - if (g.material == s_DefaultMaterial) - { - g.material = null; - } - g.SetMaterialDirty(); - } - ReleaseMaterial(ref _maskMaterial); - - _softMask = null; - } - - /// - /// Release the material. - /// - void ReleaseMaterial(ref Material mat) - { - if (mat) - { - StencilMaterial.Remove(mat); - - #if UNITY_EDITOR - if (!Application.isPlaying) - { - DestroyImmediate(mat); - } - else - #endif - { - Destroy(mat); - } - mat = null; - } - } - - - void ISerializationCallbackReceiver.OnBeforeSerialize() - { - } - - void ISerializationCallbackReceiver.OnAfterDeserialize() - { - #pragma warning disable 0612 - if (m_Inverse) - { - m_Inverse = false; - m_MaskInteraction = (2 << 0) + (2 << 2) + (2 << 4) + (2 << 6); - } - #pragma warning restore 0612 - } - } + s_ActiveSoftMaskables.Add(this); + + graphic.SetMaterialDirtyEx(); + _softMask = null; + } + + /// + /// This function is called when the behaviour becomes disabled. + /// + private void OnDisable() + { + s_ActiveSoftMaskables.Remove(this); + + graphic.SetMaterialDirtyEx(); + _softMask = null; + + MaterialCache.Unregister(_effectMaterialHash); + _effectMaterialHash = k_InvalidHash; + } + +#if UNITY_EDITOR + /// + /// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only). + /// + private void OnValidate() + { + graphic.SetMaterialDirtyEx(); + } + + void ISerializationCallbackReceiver.OnBeforeSerialize() + { + } + + void ISerializationCallbackReceiver.OnAfterDeserialize() + { +#pragma warning disable 0612 + if (m_Inverse) + { + m_Inverse = false; + m_MaskInteraction = (2 << 0) + (2 << 2) + (2 << 4) + (2 << 6); + } +#pragma warning restore 0612 + + var current = this; + UnityEditor.EditorApplication.delayCall += () => + { + if (current && graphic && graphic.material && graphic.material.shader && + graphic.material.shader.name == "Hidden/UI/Default (SoftMaskable)") + { + graphic.material = null; + graphic.SetMaterialDirtyEx(); + } + }; +#endif + } + } } diff --git a/Shaders/Resources/UI-Default-SoftMask.shader b/Shaders/Resources/UI-Default-SoftMaskable.shader similarity index 98% rename from Shaders/Resources/UI-Default-SoftMask.shader rename to Shaders/Resources/UI-Default-SoftMaskable.shader index 7bc5c5e..e5b5719 100644 --- a/Shaders/Resources/UI-Default-SoftMask.shader +++ b/Shaders/Resources/UI-Default-SoftMaskable.shader @@ -1,4 +1,4 @@ -Shader "UI/Default-SoftMask" +Shader "Hidden/UI/Default (SoftMaskable)" { Properties { @@ -52,7 +52,7 @@ Shader "UI/Default-SoftMask" #include "UnityCG.cginc" #include "UnityUI.cginc" - + #pragma multi_compile __ UNITY_UI_CLIP_RECT #pragma multi_compile __ UNITY_UI_ALPHACLIP diff --git a/Shaders/Resources/UI-Default-SoftMask.shader.meta b/Shaders/Resources/UI-Default-SoftMaskable.shader.meta similarity index 100% rename from Shaders/Resources/UI-Default-SoftMask.shader.meta rename to Shaders/Resources/UI-Default-SoftMaskable.shader.meta diff --git a/Shaders/TextMeshProSupport/TMP_SDF (SoftMaskable).shader b/Shaders/TextMeshProSupport/TMP_SDF (SoftMaskable).shader index 60aef70..caaf88f 100644 --- a/Shaders/TextMeshProSupport/TMP_SDF (SoftMaskable).shader +++ b/Shaders/TextMeshProSupport/TMP_SDF (SoftMaskable).shader @@ -1,4 +1,4 @@ -Shader "TextMeshPro/Distance Field (SoftMaskable)" { +Shader "Hidden/TextMeshPro/Distance Field (SoftMaskable)" { Properties { _FaceTex ("Face Texture", 2D) = "white" {} @@ -35,7 +35,7 @@ Properties { _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) - + _UnderlayColor ("Border Color", Color) = (0,0,0, 0.5) _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 @@ -67,7 +67,7 @@ Properties { _VertexOffsetX ("Vertex OffsetX", float) = 0 _VertexOffsetY ("Vertex OffsetY", float) = 0 - + _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) _MaskSoftnessX ("Mask SoftnessX", float) = 0 @@ -95,7 +95,7 @@ SubShader { { Ref [_Stencil] Comp [_StencilComp] - Pass [_StencilOp] + Pass [_StencilOp] ReadMask [_StencilReadMask] WriteMask [_StencilWriteMask] } @@ -126,7 +126,7 @@ SubShader { #include "UnityUI.cginc" #include "Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc" #include "Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc" - + #include "Packages/com.coffee.softmask-for-ugui/Shaders/SoftMask.cginc" #pragma shader_feature __ SOFTMASK_EDITOR @@ -146,7 +146,7 @@ SubShader { float4 param : TEXCOORD1; // alphaClip, scale, bias, weight float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw) float3 viewDir : TEXCOORD3; - + #if (UNDERLAY_ON || UNDERLAY_INNER) float4 texcoord2 : TEXCOORD4; // u,v, scale, bias fixed4 underlayColor : COLOR1; @@ -181,7 +181,7 @@ SubShader { float bias =(.5 - weight) + (.5 / scale); float alphaClip = (1.0 - _OutlineWidth*_ScaleRatioA - _OutlineSoftness*_ScaleRatioA); - + #if GLOW_ON alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB); #endif @@ -232,7 +232,7 @@ SubShader { fixed4 PixShader(pixel_t input) : SV_Target { float c = tex2D(_MainTex, input.atlas).a; - + #ifndef UNDERLAY_ON clip(c - input.param.x); #endif @@ -249,7 +249,7 @@ SubShader { half4 outlineColor = _OutlineColor; faceColor.rgb *= input.color.rgb; - + faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); @@ -294,9 +294,9 @@ SubShader { half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); faceColor *= m.x * m.y; #endif - + faceColor *= SoftMask(input.position, input.worldPosition); - + #if UNITY_UI_ALPHACLIP clip(faceColor.a - 0.001); #endif diff --git a/Shaders/TextMeshProSupport/TMP_SDF-Mobile (SoftMaskable).shader b/Shaders/TextMeshProSupport/TMP_SDF-Mobile (SoftMaskable).shader index b521cd5..84a3ed1 100644 --- a/Shaders/TextMeshProSupport/TMP_SDF-Mobile (SoftMaskable).shader +++ b/Shaders/TextMeshProSupport/TMP_SDF-Mobile (SoftMaskable).shader @@ -3,7 +3,7 @@ // - No Glow Option // - Softness is applied on both side of the outline -Shader "TextMeshPro/Mobile/Distance Field (SoftMaskable)" { +Shader "Hidden/TextMeshPro/Mobile/Distance Field (SoftMaskable)" { Properties { _FaceColor ("Face Color", Color) = (1,1,1,1) @@ -41,18 +41,18 @@ Properties { _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) _MaskSoftnessX ("Mask SoftnessX", float) = 0 _MaskSoftnessY ("Mask SoftnessY", float) = 0 - + _StencilComp ("Stencil Comparison", Float) = 8 _Stencil ("Stencil ID", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0 _StencilWriteMask ("Stencil Write Mask", Float) = 255 _StencilReadMask ("Stencil Read Mask", Float) = 255 - + _ColorMask ("Color Mask", Float) = 15 } SubShader { - Tags + Tags { "Queue"="Transparent" "IgnoreProjector"="True" @@ -64,7 +64,7 @@ SubShader { { Ref [_Stencil] Comp [_StencilComp] - Pass [_StencilOp] + Pass [_StencilOp] ReadMask [_StencilReadMask] WriteMask [_StencilWriteMask] } @@ -94,7 +94,7 @@ SubShader { #include "UnityCG.cginc" #include "UnityUI.cginc" #include "Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc" - + #include "Packages/com.coffee.softmask-for-ugui/Shaders/SoftMask.cginc" #pragma shader_feature __ SOFTMASK_EDITOR @@ -132,7 +132,7 @@ SubShader { float2 pixelSize = vPosition.w; pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); - + float scale = rsqrt(dot(pixelSize, pixelSize)); scale *= abs(input.texcoord1.y) * _GradientScale * 1.5; if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); @@ -223,9 +223,9 @@ SubShader { #if (UNDERLAY_ON | UNDERLAY_INNER) c *= input.texcoord1.z; #endif - + c *= SoftMask(input.vertex, input.worldPosition); - + #if UNITY_UI_ALPHACLIP clip(c.a - 0.001); #endif diff --git a/Shaders/TextMeshProSupport/TMP_Sprite (SoftMaskable).shader b/Shaders/TextMeshProSupport/TMP_Sprite (SoftMaskable).shader index 8451d05..4bfc2b5 100644 --- a/Shaders/TextMeshProSupport/TMP_Sprite (SoftMaskable).shader +++ b/Shaders/TextMeshProSupport/TMP_Sprite (SoftMaskable).shader @@ -1,10 +1,10 @@ -Shader "TextMeshPro/Sprite (SoftMaskable)" +Shader "Hidden/TextMeshPro/Sprite (SoftMaskable)" { Properties { _MainTex ("Sprite Texture", 2D) = "white" {} _Color ("Tint", Color) = (1,1,1,1) - + _StencilComp ("Stencil Comparison", Float) = 8 _Stencil ("Stencil ID", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0 @@ -20,19 +20,19 @@ Shader "TextMeshPro/Sprite (SoftMaskable)" SubShader { Tags - { - "Queue"="Transparent" - "IgnoreProjector"="True" - "RenderType"="Transparent" + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" } - + Stencil { Ref [_Stencil] Comp [_StencilComp] - Pass [_StencilOp] + Pass [_StencilOp] ReadMask [_StencilReadMask] WriteMask [_StencilWriteMask] } @@ -55,10 +55,10 @@ Shader "TextMeshPro/Sprite (SoftMaskable)" #pragma multi_compile __ UNITY_UI_CLIP_RECT #pragma multi_compile __ UNITY_UI_ALPHACLIP - + #include "Packages/com.coffee.softmask-for-ugui/Shaders/SoftMask.cginc" #pragma shader_feature __ SOFTMASK_EDITOR - + struct appdata_t { float4 vertex : POSITION; @@ -73,7 +73,7 @@ Shader "TextMeshPro/Sprite (SoftMaskable)" half2 texcoord : TEXCOORD0; float4 worldPosition : TEXCOORD1; }; - + fixed4 _Color; fixed4 _TextureSampleAdd; float4 _ClipRect; @@ -85,11 +85,11 @@ Shader "TextMeshPro/Sprite (SoftMaskable)" OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); OUT.texcoord = IN.texcoord; - + #ifdef UNITY_HALF_TEXEL_OFFSET OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1); #endif - + OUT.color = IN.color * _Color; return OUT; } @@ -99,13 +99,13 @@ Shader "TextMeshPro/Sprite (SoftMaskable)" fixed4 frag(v2f IN) : SV_Target { half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; - + #if UNITY_UI_CLIP_RECT color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); #endif - + color.a *= SoftMask(IN.vertex, IN.worldPosition); - + #ifdef UNITY_UI_ALPHACLIP clip (color.a - 0.001); #endif diff --git a/package.json b/package.json index f1dac31..26669a4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.coffee.softmask-for-ugui", "displayName": "UI Soft Mask", "description": "UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.\nBy using SoftMask instead of the default Mask component, you can beautifully represent the rounded edges of UI elements.", - "version": "0.10.0-preview.3", + "version": "1.0.0-preview.1", "unity": "2017.1", "license": "MIT", "repository": {