Moved effects to their own folder

Finished testing of UI Image Crop control

--HG--
branch : develop_4.6
pull/413/head
Simon (darkside) Jackson 2015-12-01 16:01:01 +00:00
parent cfe6f3057a
commit bfaba5d397
17 changed files with 12 additions and 9 deletions

Binary file not shown.

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 7919197bf9b9d854fa3b0b0c116c2152
NativeFormatImporter:
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9c13e9266c2d4ed4d9dfe8d643b19d09 guid: cbbc72115bdf3fe4a93d8566634c6e61
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
userData: userData:

View File

@ -4,7 +4,7 @@
namespace UnityEngine.UI.Extensions namespace UnityEngine.UI.Extensions
{ {
[AddComponentMenu("UI/Extensions/UIImageCrop")] [AddComponentMenu("UI/Effects/Extensions/UIImageCrop")]
[ExecuteInEditMode] [ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))] [RequireComponent(typeof(RectTransform))]
public class UIImageCrop : MonoBehaviour public class UIImageCrop : MonoBehaviour
@ -19,9 +19,9 @@ namespace UnityEngine.UI.Extensions
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
SetMaterial(); SetMaterial();
} }
public void SetMaterial() public void SetMaterial()
{ {
mGraphic = this.GetComponent<MaskableGraphic>(); mGraphic = this.GetComponent<MaskableGraphic>();
@ -29,10 +29,17 @@ namespace UnityEngine.UI.Extensions
YCropProperty = Shader.PropertyToID("_YCrop"); YCropProperty = Shader.PropertyToID("_YCrop");
if (mGraphic != null) if (mGraphic != null)
{ {
mat = mGraphic.material; 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 component to a Graphical UI component");
} }
else Debug.LogError("Please attach a UI component");
} }
public void OnValidate() public void OnValidate()
{ {