Moved effects to their own folder
Finished testing of UI Image Crop control --HG-- branch : develop_4.6pull/413/head
parent
cfe6f3057a
commit
bfaba5d397
Binary file not shown.
|
@ -1,4 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7919197bf9b9d854fa3b0b0c116c2152
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9c13e9266c2d4ed4d9dfe8d643b19d09
|
||||
guid: cbbc72115bdf3fe4a93d8566634c6e61
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -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<MaskableGraphic>();
|
||||
|
@ -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()
|
||||
{
|
Loading…
Reference in New Issue