diff --git a/Materials/UIImageCropMaterial.mat b/Materials/UIImageCropMaterial.mat deleted file mode 100644 index c1fa6e7..0000000 Binary files a/Materials/UIImageCropMaterial.mat and /dev/null differ diff --git a/Materials/UIImageCropMaterial.mat.meta b/Materials/UIImageCropMaterial.mat.meta deleted file mode 100644 index 649017b..0000000 --- a/Materials/UIImageCropMaterial.mat.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 7919197bf9b9d854fa3b0b0c116c2152 -NativeFormatImporter: - userData: diff --git a/Materials.meta b/Scripts/Effects.meta similarity index 63% rename from Materials.meta rename to Scripts/Effects.meta index d0db19e..a01b9d9 100644 --- a/Materials.meta +++ b/Scripts/Effects.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9c13e9266c2d4ed4d9dfe8d643b19d09 +guid: cbbc72115bdf3fe4a93d8566634c6e61 folderAsset: yes DefaultImporter: userData: diff --git a/Scripts/BestFitOutline.cs b/Scripts/Effects/BestFitOutline.cs similarity index 100% rename from Scripts/BestFitOutline.cs rename to Scripts/Effects/BestFitOutline.cs diff --git a/Scripts/BestFitOutline.cs.meta b/Scripts/Effects/BestFitOutline.cs.meta similarity index 100% rename from Scripts/BestFitOutline.cs.meta rename to Scripts/Effects/BestFitOutline.cs.meta diff --git a/Scripts/CurvedText.cs b/Scripts/Effects/CurvedText.cs similarity index 100% rename from Scripts/CurvedText.cs rename to Scripts/Effects/CurvedText.cs diff --git a/Scripts/CurvedText.cs.meta b/Scripts/Effects/CurvedText.cs.meta similarity index 100% rename from Scripts/CurvedText.cs.meta rename to Scripts/Effects/CurvedText.cs.meta diff --git a/Scripts/Gradient.cs b/Scripts/Effects/Gradient.cs similarity index 100% rename from Scripts/Gradient.cs rename to Scripts/Effects/Gradient.cs diff --git a/Scripts/Gradient.cs.meta b/Scripts/Effects/Gradient.cs.meta similarity index 100% rename from Scripts/Gradient.cs.meta rename to Scripts/Effects/Gradient.cs.meta diff --git a/Scripts/LetterSpacing.cs b/Scripts/Effects/LetterSpacing.cs similarity index 100% rename from Scripts/LetterSpacing.cs rename to Scripts/Effects/LetterSpacing.cs diff --git a/Scripts/LetterSpacing.cs.meta b/Scripts/Effects/LetterSpacing.cs.meta similarity index 100% rename from Scripts/LetterSpacing.cs.meta rename to Scripts/Effects/LetterSpacing.cs.meta diff --git a/Scripts/NicerOutline.cs b/Scripts/Effects/NicerOutline.cs similarity index 100% rename from Scripts/NicerOutline.cs rename to Scripts/Effects/NicerOutline.cs diff --git a/Scripts/NicerOutline.cs.meta b/Scripts/Effects/NicerOutline.cs.meta similarity index 100% rename from Scripts/NicerOutline.cs.meta rename to Scripts/Effects/NicerOutline.cs.meta diff --git a/Scripts/UIFlippable.cs b/Scripts/Effects/UIFlippable.cs similarity index 100% rename from Scripts/UIFlippable.cs rename to Scripts/Effects/UIFlippable.cs diff --git a/Scripts/UIFlippable.cs.meta b/Scripts/Effects/UIFlippable.cs.meta similarity index 100% rename from Scripts/UIFlippable.cs.meta rename to Scripts/Effects/UIFlippable.cs.meta diff --git a/Scripts/UIImageCrop.cs b/Scripts/Effects/UIImageCrop.cs similarity index 74% rename from Scripts/UIImageCrop.cs rename to Scripts/Effects/UIImageCrop.cs index 22538ae..46c4065 100644 --- a/Scripts/UIImageCrop.cs +++ b/Scripts/Effects/UIImageCrop.cs @@ -4,7 +4,7 @@ namespace UnityEngine.UI.Extensions { - [AddComponentMenu("UI/Extensions/UIImageCrop")] + [AddComponentMenu("UI/Effects/Extensions/UIImageCrop")] [ExecuteInEditMode] [RequireComponent(typeof(RectTransform))] public class UIImageCrop : MonoBehaviour @@ -19,9 +19,9 @@ namespace UnityEngine.UI.Extensions // Use this for initialization void Start() { - SetMaterial(); } + public void SetMaterial() { mGraphic = this.GetComponent(); @@ -29,10 +29,17 @@ namespace UnityEngine.UI.Extensions YCropProperty = Shader.PropertyToID("_YCrop"); if (mGraphic != null) { + if (mGraphic.material == null || mGraphic.material.name == "Default UI Material") + { + //Applying default material with UI Image Crop shader + mGraphic.material = new Material(Shader.Find("UI Extensions/UI Image Crop")); + } mat = mGraphic.material; - } - else Debug.LogError("Please attach a UI component"); + else + { + Debug.LogError("Please attach component to a Graphical UI component"); + } } public void OnValidate() { diff --git a/Scripts/UIImageCrop.cs.meta b/Scripts/Effects/UIImageCrop.cs.meta similarity index 100% rename from Scripts/UIImageCrop.cs.meta rename to Scripts/Effects/UIImageCrop.cs.meta