Skip to content

Commit

Permalink
Merge pull request #29 from mob-sakai/hotfix
Browse files Browse the repository at this point in the history
Release 1.4.4
  • Loading branch information
Takashi Sakai authored Jan 16, 2018
2 parents 674c1e8 + b2c4e58 commit 3a295f8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
17 changes: 10 additions & 7 deletions Assets/UIEffect/Editor/UIEffectEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Assets/UIEffect/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 9 additions & 10 deletions Assets/UIEffect/UIEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
}

Expand Down
Binary file modified UIEffect.unitypackage
Binary file not shown.

0 comments on commit 3a295f8

Please sign in to comment.