Hello everyone,

I am a 3d artist, currently working on a test to get a job.

This test has a polygon limitation. If I enable the ‘stats’ window in the camera tab, it gives me every rendered triangles which is not what I need. I need to know how many polygons / triangles I have from my meshes, so yes I could just multiply the amount of triangles by the number of items I duplicated etc (count it manually) but it would take useless time.

Every software has that I guess it’s somewhere in here I just can’t find it?

Thank you for your help

Adrien

Hi, I wrote a little Editor Window that does what you want. Put this script in a folder called Editor, and access the panel by going to Tools/MeshInfo. It will display the Triangle and Vertex count for the object that is selected in the hierarchy.

using UnityEngine;
using System.Collections;
using UnityEditor;

public class MeshInfo : EditorWindow {

	private int vertexCount;
	private int submeshCount;
	private int triangleCount;

	[MenuItem ("Tools/Mesh Info")]
	static void Init ()
	{
		// Get existing open window or if none, make a new one:
		MeshInfo window = (MeshInfo) EditorWindow.GetWindow (typeof (MeshInfo));
		window.titleContent.text = "Mesh Info";
	}

	void OnSelectionChange()
	{
		Repaint();
	}



	void OnGUI()
	{
		if(Selection.activeGameObject && Selection.activeGameObject.GetComponent<MeshFilter>())
		{
			vertexCount = Selection.activeGameObject.GetComponent<MeshFilter>().sharedMesh.vertexCount;
			triangleCount = Selection.activeGameObject.GetComponent<MeshFilter>().sharedMesh.triangles.Length/3;
			submeshCount = Selection.activeGameObject.GetComponent<MeshFilter>().sharedMesh.subMeshCount;

			EditorGUILayout.LabelField(Selection.activeGameObject.name);
			EditorGUILayout.LabelField("Vertices: ", vertexCount.ToString());
			EditorGUILayout.LabelField("Triangles: ", triangleCount.ToString());
			EditorGUILayout.LabelField("SubMeshes: ", submeshCount.ToString());
		}
	}

}

Hey,

Thank you again for your time, I’m sorry to annoy with that, but that Void edit does not work, can’t count for multiple objects.

Thanks

Adrien