Skip to content

Instantly share code, notes, and snippets.

@dotsquid
Created October 26, 2020 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotsquid/3c9fa0aeec30d8c77abdc8303dded40d to your computer and use it in GitHub Desktop.
Save dotsquid/3c9fa0aeec30d8c77abdc8303dded40d to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.UI;
namespace SC.Utilities
{
public static class UIUtility
{
public static void AddVertFull(this VertexHelper vh, UIVertex vert) => vh.AddVert(vert.position, vert.color, vert.uv0, vert.uv1, vert.uv2, vert.uv3, vert.normal, vert.tangent);
public static void AddUIVertexQuadFull(this VertexHelper vh, UIVertex[] verts)
{
int startIndex = vh.currentVertCount;
vh.AddVertFull(verts[0]);
vh.AddVertFull(verts[1]);
vh.AddVertFull(verts[2]);
vh.AddVertFull(verts[3]);
vh.AddTriangle(startIndex, startIndex + 1, startIndex + 2);
vh.AddTriangle(startIndex + 2, startIndex + 3, startIndex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment