Edit

Share via


ScaleMeshEffect Class

Definition

On Unity UI components the unity_ObjectToWorld matrix is not the transformation matrix of the local transform the Graphic component lives on, but that of its parent Canvas. Many MRTK/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).

public ref class ScaleMeshEffect : UnityEngine::UI::BaseMeshEffect
[UnityEngine.AddComponentMenu("Scripts/MRTK/Services/ScaleMeshEffect")]
[UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/rendering/mrtk-standard-shader#ugui-support")]
[UnityEngine.RequireComponent(typeof(UnityEngine.RectTransform), typeof(UnityEngine.UI.Graphic))]
public class ScaleMeshEffect : UnityEngine.UI.BaseMeshEffect
[<UnityEngine.AddComponentMenu("Scripts/MRTK/Services/ScaleMeshEffect")>]
[<UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/rendering/mrtk-standard-shader#ugui-support")>]
[<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.HelpURLAttribute UnityEngine.RequireComponentAttribute

Constructors

ScaleMeshEffect()

Methods

Awake()

Enforces the parent canvas uses UV channel attributes.

ModifyMesh(VertexHelper)

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

Applies to