6 [RequireComponent(typeof(RectTransform), typeof(Graphic)), DisallowMultipleComponent]
7 [AddComponentMenu(
"UI/Effects/Extensions/Flippable")]
10 [SerializeField]
private bool m_Horizontal =
false;
11 [SerializeField]
private bool m_Veritical =
false;
14 protected override void Awake()
26 get {
return this.m_Horizontal; }
27 set { this.m_Horizontal = value; }
36 get {
return this.m_Veritical; }
37 set { this.m_Veritical = value; }
42 RectTransform rt = this.transform as RectTransform;
44 for (
int i = 0; i < verts.currentVertCount; ++i)
46 UIVertex uiVertex =
new UIVertex();
47 verts.PopulateUIVertex(ref uiVertex,i);
50 uiVertex.position =
new Vector3(
51 (this.m_Horizontal ? (uiVertex.position.x + (rt.rect.center.x - uiVertex.position.x) * 2) : uiVertex.position.x),
52 (
this.m_Veritical ? (uiVertex.position.y + (rt.rect.center.y - uiVertex.position.y) * 2) : uiVertex.position.y),
57 verts.SetUIVertex(uiVertex, i);
62 protected override void OnValidate()
64 var components = gameObject.GetComponents(typeof(BaseMeshEffect));
65 foreach (var comp
in components)
69 UnityEditorInternal.ComponentUtility.MoveComponentUp(
this);
73 this.GetComponent<Graphic>().SetVerticesDirty();
bool horizontal
Gets or sets a value indicating whether this UnityEngine.UI.UIFlippable should be flipped horizontall...
bool vertical
Gets or sets a value indicating whether this UnityEngine.UI.UIFlippable should be flipped vertically.
override void ModifyMesh(VertexHelper verts)
Credit Erdener Gonenc - @PixelEnvision.