### 原理:将Texture拷贝一份出来然后读取
/// <summary>
/// 不通过设置Read/Write Enabled,直接克隆一份可读的Texture2D
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static Texture2D CloneTextureToReadable(Texture2D source)
{
byte[] pix = source.GetRawTextureData();
Texture2D readableText = new Texture2D(source.width, source.height, source.format, false);
readableText.LoadRawTextureData(pix);
readableText.Apply();
return readableText;
}
//不要直接使用mesh.triangles
private int GetTriangleCount(Mesh mesh)
{
List<int> tris = new List<int>();
mesh.GetTriangles(tris, 0);
return tris.Count / 3;
}