Output tri-count from an object.

How can I output (debug.log for example) amount of tris a specific object has? For example when I attach the script to a game object, if it has a mesh file attached, count the triangles.


See this page: http://unity3d.com/support/documentation/ScriptReference/Mesh.html

you'll want mesh.triangles.Length

If your object has multiple meshes, use GetComponentsInChildren(MeshFilter) to find them all and add them up.