After using the following code I found some issues with NGUI's support for geometry that isnt a quad...
public override void OnFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color> cols)
{
Texture tex = mainTexture;
if (tex == null) return;
#if UNITY_EDITOR
if (mSprite.packed && mSprite.packingMode == SpritePackingMode.Tight)
{
var gc = drawingColor;
var sprUVs = mSprite.uv;
var sprVerts = mSprite.vertices;
var tris = mSprite.triangles;
var ppu = mSprite.pixelsPerUnit * pixelSize;
for (int i = 0; i < tris.Length; ++i)
{
verts.Add(sprVerts[tris[i]] * ppu);
uvs.Add(sprUVs[tris[i]]);
cols.Add(gc);
}
return;
}
#endif
(rest of method was unchanged)
UIDrawCall.GenerateCachedIndexBuffer runs into an IndexOutofRangeException at line 557. I'm guessing this is due to the draw call expecting quads and making certain assumptions in how it reads the vertices. Seems to be something that can NOT be ignored.
UIDrawCall.UpdateGeometry assumed the geometry is bad due to part of the IF check that looks for "(verts.size % 4) == 0". I had to remove that one check and then it seemed to behave fine.
UI2DSpriteEditor.OnPreviewGUI cannot render a preview at line 89 since it also expects a quad based sprite. Though this is easy to skip for tightly packed sprites, for the short term, by adding more conditions in the IF check.
Lastly, the mesh looks 75% correct but the mesh is drawn out of order with several extra triangles even though I'm pretty sure I have the right ordering code for mesh rendering. I'm guessing this is also due to NGUI expecting quads for the mesh, like GenerateCachedIndexBuffer.
(for attachment: left image is UI2DSprite, right image is SpriteRenderer)