Class BaseMeshEffect
Base class for effects that modify the generated Mesh.
Inherited Members
UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
UnityEngine.Object.FindFirstObjectByType<T>()
UnityEngine.Object.FindAnyObjectByType<T>()
UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
Namespace: UnityEngine.UI
Syntax
[ExecuteAlways]
public abstract class BaseMeshEffect : UIBehaviour, IMeshModifier
Examples
using UnityEngine;
using UnityEngine.UI;
public class PositionAsUV1 : BaseMeshEffect
{
protected PositionAsUV1()
{}
public override void ModifyMesh(Mesh mesh)
{
if (!IsActive())
return;
var verts = mesh.vertices.ToList();
var uvs = ListPool<Vector2>.Get();
for (int i = 0; i < verts.Count; i++)
{
var vert = verts[i];
uvs.Add(new Vector2(verts[i].x, verts[i].y));
verts[i] = vert;
}
mesh.SetUVs(1, uvs);
ListPool<Vector2>.Release(uvs);
}
}
Properties
graphic
The graphic component that the Mesh Effect will aplly to.
Declaration
protected Graphic graphic { get; }
Property Value
Type | Description |
---|---|
Graphic |
Methods
ModifyMesh(Mesh)
Function that is called when the Graphic is populating the mesh.
Declaration
public virtual void ModifyMesh(Mesh mesh)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The generated mesh of the Graphic element that needs modification. |
Implements
ModifyMesh(VertexHelper)
Declaration
public abstract void ModifyMesh(VertexHelper vh)
Parameters
Type | Name | Description |
---|---|---|
VertexHelper | vh |
Implements
OnDidApplyAnimationProperties()
Called from the native side any time a animation property is changed.
Declaration
protected override void OnDidApplyAnimationProperties()
Overrides
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Declaration
protected override void OnEnable()