diff --git a/Assets/UIEffect/Editor/UIEffectEditor.cs b/Assets/UIEffect/Editor/UIEffectEditor.cs index 13142025..eb922880 100644 --- a/Assets/UIEffect/Editor/UIEffectEditor.cs +++ b/Assets/UIEffect/Editor/UIEffectEditor.cs @@ -112,7 +112,7 @@ public static Material GetOrCreateMaterial(Shader shader, UIEffect.ToneMode tone + (0 < tone ? "-" + tone : "") + (0 < color ? "-" + color : "") + (0 < blur ? "-" + blur : ""); - mat.hideFlags = HideFlags.NotEditable; + //mat.hideFlags = HideFlags.NotEditable; Directory.CreateDirectory("Assets/UIEffect/Materials"); AssetDatabase.CreateAsset(mat, "Assets/UIEffect/Materials/" + mat.name + ".mat"); @@ -217,14 +217,17 @@ public override void OnInspectorGUI() serializedObject.ApplyModifiedProperties(); #if UNITY_5_6_OR_NEWER - var canvas = (target as UIEffect).graphic.canvas; - if( 0 == (canvas.additionalShaderChannels & AdditionalCanvasShaderChannels.TexCoord1)) + if((target as UIEffect).graphic) { - using (new GUILayout.HorizontalScope()) + var canvas = (target as UIEffect).graphic.canvas; + if( canvas && 0 == (canvas.additionalShaderChannels & AdditionalCanvasShaderChannels.TexCoord1)) { - EditorGUILayout.HelpBox("[Unity5.6+] Enable TexCoord1 of Canvas.additionalShaderChannels to use UIEffect.", MessageType.Warning); - if (GUILayout.Button("Fix")) - canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1; + using (new GUILayout.HorizontalScope()) + { + EditorGUILayout.HelpBox("[Unity5.6+] Enable TexCoord1 of Canvas.additionalShaderChannels to use UIEffect.", MessageType.Warning); + if (GUILayout.Button("Fix")) + canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1; + } } } #endif diff --git a/Assets/UIEffect/Readme.md b/Assets/UIEffect/Readme.md index 0f1d3a99..b21369a0 100644 --- a/Assets/UIEffect/Readme.md +++ b/Assets/UIEffect/Readme.md @@ -98,18 +98,26 @@ Please enable `TexCoord1` to use UIEffect. ## Release Notes +### ver.1.4.4 + +* Fixed: Error has occur on edit prefab. [#27](https://github.com/mob-sakai/UIEffect/issues/27) + + ### ver.1.4.3 * Fixed: Color effect is incorrect. [#19](https://github.com/mob-sakai/UIEffect/issues/19) + ### ver.1.4.2 * Fixed: Error has occur on after deserialize. [#16](https://github.com/mob-sakai/UIEffect/issues/16) + ### ver.1.4.1 * Fixed: Demo link in `readme.md` is broken. + ### ver.1.4.0 * Changed: ToneMode, ColorMode, BlurMode can be changed only in editor. diff --git a/Assets/UIEffect/UIEffect.cs b/Assets/UIEffect/UIEffect.cs index 31375b04..484ecd86 100644 --- a/Assets/UIEffect/UIEffect.cs +++ b/Assets/UIEffect/UIEffect.cs @@ -332,17 +332,16 @@ public void OnAfterDeserialize() var obj = this; EditorApplication.delayCall += () => { - if (!obj) + if (Application.isPlaying || !obj) return; - - var old = m_EffectMaterial; - m_EffectMaterial = GetMaterial(Shader.Find(shaderName), toneMode, colorMode, blurMode); - if (old != m_EffectMaterial) - { - EditorUtility.SetDirty(this); - EditorApplication.delayCall +=AssetDatabase.SaveAssets; - } - graphic.material = m_EffectMaterial; + + var mat = GetMaterial(Shader.Find(shaderName), toneMode, colorMode, blurMode); + if(m_EffectMaterial == mat) + return; + + graphic.material = m_EffectMaterial = mat; + EditorUtility.SetDirty(this); + EditorApplication.delayCall +=AssetDatabase.SaveAssets; }; } diff --git a/UIEffect.unitypackage b/UIEffect.unitypackage index d3526432..23186476 100644 Binary files a/UIEffect.unitypackage and b/UIEffect.unitypackage differ