Class BaseMeshEffect
Base class for effects that modify the generated Mesh.
Implements
Inherited Members
Component.GetComponentIndex()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Scene)
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: UnityEngine.UI
Assembly: UnityEngine.UI.dll
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. |
ModifyMesh(VertexHelper)
Call used to modify mesh. Place any custom mesh processing in this function.
Declaration
public abstract void ModifyMesh(VertexHelper vh)
Parameters
Type | Name | Description |
---|---|---|
VertexHelper | vh |
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()
Overrides
OnValidate()
Declaration
protected override void OnValidate()