Unity版本:5.1.2
网格顶点数量 / 7.845 = 网格占用内存
[MenuItem("Assets/GetVerctorNum")]
static void GetVerctorNum() {
Object[] selectedAsset = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
int count = 0;
int meshCount = 0;
int triCount = 0;
for (int i = 0; i < selectedAsset.Length; i++) {
GameObject obj = selectedAsset[i] as GameObject;
MeshFilter[] filters = obj.GetComponentsInChildren<MeshFilter>(true);
if(filters != null){
for (int j = 0; j < filters.Length; j++) {
MeshFilter f = filters[j];
count += f.sharedMesh.vertexCount;
triCount += f.sharedMesh.triangles.Length / 3;
meshCount++;
}
}
}
Debug.LogWarning("总共Mesh=" + meshCount + " 总共顶点=" + count + " 总共三角形="+triCount);
}