ScaleMeshEffect Class

Definition

On Unity UI components the UNITY_MATRIX_M (unity_ObjectToWorld) matrix is not the transformation matrix of the local transform the Graphic component lives on, but that of its parent Canvas. Many Graphics Tools/Standard shader effects require object scale to be known. To solve this issue the ScaleMeshEffect will store scaling information into UV channel attributes during UI mesh construction. Ideally we would store the scale in one attribute but UGUI only supports two scalers per attribute (even in the tangent attribute).

[UnityEngine.AddComponentMenu("Scripts/GraphicsTools/ScaleMeshEffect")]
[UnityEngine.RequireComponent(typeof(UnityEngine.RectTransform), typeof(UnityEngine.UI.Graphic))]
public class ScaleMeshEffect : UnityEngine.UI.BaseMeshEffect
[<UnityEngine.AddComponentMenu("Scripts/GraphicsTools/ScaleMeshEffect")>]
[<UnityEngine.RequireComponent(typeof(UnityEngine.RectTransform), typeof(UnityEngine.UI.Graphic))>]
type ScaleMeshEffect = class
    inherit BaseMeshEffect
Public Class ScaleMeshEffect
Inherits BaseMeshEffect
Inheritance
UnityEngine.UI.BaseMeshEffect
ScaleMeshEffect
Attributes
UnityEngine.AddComponentMenuAttribute UnityEngine.RequireComponentAttribute

Constructors

ScaleMeshEffect()

Methods

ModifyMesh(VertexHelper)

Stores scaling information into UV channel attributes during UI mesh construction.

Start()

Enforces the parent canvas uses UV channel attributes.

Applies to