如上图,当showPercent调到0时还有一块是亮的,其余的到1都是正常的
//定义
private int segements = 100;
private float showPercent = 1.0f;
protected override void OnPopulateMesh(VertexHelper toFill)
{
int realSegement = (int)(showPercent * segements);
//颜色处理部分
UIVertex origin = new UIVertex();
origin.color = new Color32(60, 60, 60, 225);
int vertexCount = realSegement + 1;
for (int i = 0; i < segements + 1; i++)
{
UIVertex vertexTemp = new UIVertex();
if (i < vertexCount)
{
vertexTemp.color = color;
}
else
{
vertexTemp.color = new Color32(60, 60, 60, 225);
}
}
//画图部分
int id = 1;
for (int i = 0; i < segements; i++)
{
toFill.AddTriangle(id, 0, id + 1);
id++;
}
}
找了一天了没找到原因,辛苦老师帮忙看看