diff --git a/CHANGELOG.md b/CHANGELOG.md index 10012822..c9a2e1cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [4.0.0-preview.9](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.8...v4.0.0-preview.9) (2020-06-09) + + +### Features + +* add a new property to access EffectPlayer at runtime ([d92efa9](https://github.com/mob-sakai/UIEffect/commit/d92efa98a1fc7b78d3421d9ee0b4bdaa74511bdc)), closes [#214](https://github.com/mob-sakai/UIEffect/issues/214) [#215](https://github.com/mob-sakai/UIEffect/issues/215) + # [4.0.0-preview.8](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.7...v4.0.0-preview.8) (2020-06-04) diff --git a/Resources/UIDissolve.shader b/Resources/UIDissolve.shader index f540e995..1f48a1de 100644 --- a/Resources/UIDissolve.shader +++ b/Resources/UIDissolve.shader @@ -1,4 +1,4 @@ -Shader "Hidden/UIDissolve" +Shader "Hidden/UI/Default (UIDissolve)" { Properties { diff --git a/Resources/UIEffect.shader b/Resources/UIEffect.shader index c40ae9c8..3397a0f5 100644 --- a/Resources/UIEffect.shader +++ b/Resources/UIEffect.shader @@ -1,4 +1,4 @@ -Shader "Hidden/UIEffect" +Shader "Hidden/UI/Default (UIEffect)" { Properties { diff --git a/Resources/UIHsvModifier.shader b/Resources/UIHsvModifier.shader index c2909bb7..445182b5 100644 --- a/Resources/UIHsvModifier.shader +++ b/Resources/UIHsvModifier.shader @@ -1,10 +1,10 @@ -Shader "Hidden/UIHsvModifier" +Shader "Hidden/UI/Default (UIHsvModifier)" { Properties { [PerRendererData] _MainTex ("Main 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 @@ -21,19 +21,19 @@ 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] } @@ -76,4 +76,4 @@ ENDCG } } -} \ No newline at end of file +} diff --git a/Resources/UIShiny.shader b/Resources/UIShiny.shader index 17598910..5520e435 100644 --- a/Resources/UIShiny.shader +++ b/Resources/UIShiny.shader @@ -1,10 +1,10 @@ -Shader "Hidden/UIShiny" +Shader "Hidden/UI/Default (UIShiny)" { Properties { [PerRendererData] _MainTex ("Main 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 @@ -21,19 +21,19 @@ Shader "Hidden/UIShiny" 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] } @@ -53,9 +53,9 @@ Shader "Hidden/UIShiny" #pragma vertex vert #pragma fragment frag #pragma target 2.0 - + #pragma multi_compile __ UNITY_UI_ALPHACLIP - + #include "UnityCG.cginc" #include "UnityUI.cginc" @@ -69,11 +69,11 @@ Shader "Hidden/UIShiny" color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); color = ApplyShinyEffect(color, IN.eParam); - + #ifdef UNITY_UI_ALPHACLIP clip (color.a - 0.001); #endif - + return color; } ENDCG diff --git a/Resources/UITtransition.shader b/Resources/UITtransition.shader index 872ffed4..d7c168ed 100644 --- a/Resources/UITtransition.shader +++ b/Resources/UITtransition.shader @@ -1,4 +1,4 @@ -Shader "Hidden/UITransition" +Shader "Hidden/UI/Default (UITransition)" { Properties { diff --git a/Scripts/Common/BaseMaterialEffect.cs b/Scripts/Common/BaseMaterialEffect.cs index 1669e09a..0cf2d7a6 100644 --- a/Scripts/Common/BaseMaterialEffect.cs +++ b/Scripts/Common/BaseMaterialEffect.cs @@ -128,12 +128,13 @@ protected override void OnValidate() /// protected override void OnEnable() { + base.OnEnable(); + if (paramTex != null) { paramTex.Register(this); } - SetVerticesDirty(); SetMaterialDirty(); SetEffectParamsDirty(); @@ -149,7 +150,8 @@ protected override void OnEnable() /// protected override void OnDisable() { - SetVerticesDirty(); + base.OnDisable(); + SetMaterialDirty(); if (paramTex != null) diff --git a/Scripts/Common/GraphicConnector.cs b/Scripts/Common/GraphicConnector.cs index aa6f4137..3046297c 100644 --- a/Scripts/Common/GraphicConnector.cs +++ b/Scripts/Common/GraphicConnector.cs @@ -112,14 +112,6 @@ public virtual void SetMaterialDirty(Graphic graphic) graphic.SetMaterialDirty(); } - /// - /// Event that is called just before Canvas rendering happens. - /// This allows you to delay processing / updating of canvas based elements until just before they are rendered. - /// - protected virtual void OnWillRenderCanvases() - { - } - /// /// Gets position factor for area. /// diff --git a/Scripts/UIDissolve.cs b/Scripts/UIDissolve.cs index 095174c9..de49ef2b 100644 --- a/Scripts/UIDissolve.cs +++ b/Scripts/UIDissolve.cs @@ -196,7 +196,7 @@ public override ParameterTexture paramTex get { return s_ParamTex; } } - EffectPlayer effectPlayer + public EffectPlayer effectPlayer { get { return m_Player ?? (m_Player = new EffectPlayer()); } } @@ -219,7 +219,7 @@ public override Hash128 GetMaterialHash(Material material) public override void ModifyMaterial(Material newMaterial, Graphic graphic) { var connector = GraphicConnector.FindConnector(graphic); - newMaterial.shader = connector.FindShader("UIDissolve"); + newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIDissolve)", newMaterial.shader.name)); SetShaderVariants(newMaterial, m_ColorMode); newMaterial.SetTexture(k_TransitionTexId, transitionTexture); diff --git a/Scripts/UIEffect.cs b/Scripts/UIEffect.cs index 42ac0ced..63a8ccc9 100644 --- a/Scripts/UIEffect.cs +++ b/Scripts/UIEffect.cs @@ -194,7 +194,7 @@ public override void ModifyMaterial(Material newMaterial, Graphic graphic) { var connector = GraphicConnector.FindConnector(graphic); - newMaterial.shader = connector.FindShader("UIEffect"); + newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIEffect)", newMaterial.shader.name)); SetShaderVariants(newMaterial, m_EffectMode, m_ColorMode, m_BlurMode, m_AdvancedBlur ? BlurEx.Ex : BlurEx.None); diff --git a/Scripts/UIHsvModifier.cs b/Scripts/UIHsvModifier.cs index 16335e72..8445bb72 100644 --- a/Scripts/UIHsvModifier.cs +++ b/Scripts/UIHsvModifier.cs @@ -129,7 +129,7 @@ public override void ModifyMaterial(Material newMaterial, Graphic graphic) { var connector = GraphicConnector.FindConnector(graphic); - newMaterial.shader = connector.FindShader("UIHsvModifier"); + newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIHsvModifier)", newMaterial.shader.name)); paramTex.RegisterMaterial(newMaterial); } diff --git a/Scripts/UIShiny.cs b/Scripts/UIShiny.cs index b2cabeec..3b938cb5 100644 --- a/Scripts/UIShiny.cs +++ b/Scripts/UIShiny.cs @@ -153,7 +153,7 @@ public override ParameterTexture paramTex get { return s_ParamTex; } } - EffectPlayer effectPlayer + public EffectPlayer effectPlayer { get { return m_Player ?? (m_Player = new EffectPlayer()); } } @@ -194,7 +194,7 @@ public override void ModifyMaterial(Material newMaterial, Graphic graphic) { var connector = GraphicConnector.FindConnector(graphic); - newMaterial.shader = connector.FindShader("UIShiny"); + newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIShiny)", newMaterial.shader.name)); paramTex.RegisterMaterial(newMaterial); } diff --git a/Scripts/UITransitionEffect.cs b/Scripts/UITransitionEffect.cs index 3051249c..b75dfd20 100644 --- a/Scripts/UITransitionEffect.cs +++ b/Scripts/UITransitionEffect.cs @@ -192,7 +192,7 @@ public bool passRayOnHidden set { m_PassRayOnHidden = value; } } - EffectPlayer effectPlayer + public EffectPlayer effectPlayer { get { return m_Player ?? (m_Player = new EffectPlayer()); } } @@ -234,7 +234,7 @@ public override Hash128 GetMaterialHash(Material material) public override void ModifyMaterial(Material newMaterial, Graphic graphic) { var connector = GraphicConnector.FindConnector(graphic); - newMaterial.shader = connector.FindShader("UITransition"); + newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UITransition)", newMaterial.shader.name)); SetShaderVariants(newMaterial, m_EffectMode); newMaterial.SetTexture(k_TransitionTexId, transitionTexture); diff --git a/package.json b/package.json index ec8e9bac..a97ce8ea 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.coffee.ui-effect", "displayName": "UI Effect", "description": "UI Effect provides visual effect components for Unity UI.\nLet's decorate your UI with effects!", - "version": "4.0.0-preview.8", + "version": "4.0.0-preview.9", "unity": "2017.1", "license": "MIT", "repository": {