UnityEngine.UI.VertexHelper.GetUIVertexStream C# (CSharp) Method

GetUIVertexStream() public method

public GetUIVertexStream ( List stream ) : void
stream List
return void
        public void GetUIVertexStream(List<UIVertex> stream)
        {
            if (stream != null)
            {
                CanvasRenderer.CreateUIVertexStream(stream, this.m_Positions, this.m_Colors, this.m_Uv0S, this.m_Uv1S, this.m_Normals, this.m_Tangents, this.m_Indices);
            }
        }

Usage Example

Esempio n. 1
1
    public override void ModifyMesh(VertexHelper helper)
    {
        if (!IsActive() || helper.currentVertCount == 0)
             return;

         List<UIVertex> vertices = new List<UIVertex>();
         helper.GetUIVertexStream(vertices);

         float bottomY = vertices[0].position.y;
         float topY = vertices[0].position.y;

         for (int i = 1; i < vertices.Count; i++)
         {
             float y = vertices[i].position.y;
             if (y > topY)
             {
                 topY = y;
             }
             else if (y < bottomY)
             {
                 bottomY = y;
             }
         }

         float uiElementHeight = topY - bottomY;

         UIVertex v = new UIVertex();

         for (int i = 0; i < helper.currentVertCount; i++)
         {
             helper.PopulateUIVertex(ref v, i);
             v.color = Color32.Lerp(bottomColor, topColor, (v.position.y - bottomY) / uiElementHeight);
             helper.SetUIVertex(v, i);
         }
    }
All Usage Examples Of UnityEngine.UI.VertexHelper::GetUIVertexStream