- Home /
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.
Thanks
Comment
Best Answer
Answer by DaveA · Mar 01, 2011 at 12:43 AM
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.
Don't forget triangles.Length
returns the indices-count. Since Unity only works with trianglelists to get tri-count divide that value by 3.