# Unity's “Stats” window displays bizzare number of triangles and vertices

In my Unity scene I have:

• 7-8 Barrels (with lids) each at about 2-400 triangles.
• 4 planes, each at at the very most 200 triangles
• camera, 3 lights, a FPS controller

When I turn on the "Status" button in the lower left view port, it reports "14.1K triangles and 12.k vertices":

I've double checked everything, there's no way the elemens in the scene can amount to so many triangles. The barrels in both Blender and Unity report having the number of triangles I've specified above:

Here's a Blender screen shot:

And here's one from Unity:

I've also checked the Hierarchy panel to see if I haven't accidentally duplicated stuff which might get to be on top of stuff (such as 100 barrels all in the same position so as to look as if there's just one there), and this is not the case.

So my question is: am I misinterpreting the Unity stats window? Is it a bug in the reported triangles count there? Or am I just completely missing how all this works ?

• Try turning off lights and see if the number goes up or down. I think it renders each object for every light in forward rendering, so if you have a certain amount of lights then you're multiplying the tris/verts by a significant amount. – Tetrad Feb 4 '13 at 18:01
• @Tetrad Oh, man that was it. I had 2 lights in scene, and if I turn off one, the tri count decreases by like 4k. (goes from 14.1k to 11k). Please post your comment as an answer so I can chose it as selected answer. – Shivan Dragon Feb 4 '13 at 19:45

In forward rendering each object that is affected by a light source is rendered for each light. So with two lights, you're rendering twice as many polygons than if you had a single light.

On top of that, the optimized mesh that unity generates/imports for you may not be as few polygons/verts as what you make. I think it uses triangle strips and makes a lot of degenerate triangles so that it renders faster.

http://docs.unity3d.com/Documentation/Manual/RenderingStatistics.html

Draw Calls The total number of meshes drawn after batching was applied. Note that where objects are rendered multiple times (for example, objects illuminated by pixel lights), each rendering results in a separate draw call.

Triangle and vertices counted also include the plane and whatever those 2 black human figures. Unity's planes are ok, but if you wanted you could only use 2 triangles to make up the plane.

• Create a new folder in the project tab, name it "Editor" Within the editor create a boo script and name it "OptimizedPlane"

• Create a new folder in the project tab and name it "Model"

Copy and paste the follow code:

import UnityEngine
import UnityEditor

class OptimizedPlane (Editor):

static def Init ():
customPlane as GameObject = GameObject("Optimized Plane")

destination as string = 'Assets/Model/OptimizedPlane.asset'
mesh as Mesh = AssetDatabase.LoadAssetAtPath(destination, Mesh)

if not mesh:
mesh = Mesh()
mesh.name = 'Optimized Plane'

vertices   as (Vector3) = (Vector3(-1,0,1), Vector3(1,0,1), Vector3(1,0,-1), Vector3(-1,0,-1))
uv         as (Vector2) = (Vector2(-1,1), Vector2(1,1), Vector2(1,-1), Vector2(-1,-1))
tangents   as (Vector4) = (Vector4(-1,0,1,1), Vector4(1,0,1,1), Vector4(1,0,-1,1), Vector4(-1,0,-1,1))
triangles  as (int)     = (0,1,3,3,1,2)

mesh.vertices = vertices
mesh.uv = uv
mesh.tangents = tangents
mesh.triangles = triangles

mesh.RecalculateNormals()
mesh.RecalculateBounds()
mesh.Optimize()

AssetDatabase.CreateAsset(mesh, destination)
AssetDatabase.SaveAssets()

meshFilter.mesh = mesh
Selection.activeObject = customPlane


Gameobject > Create Other > Optimized Plane

• yes, you're right, however I did take into account the tris coming from the plane and cut-out figures, and it still doesn't add up. Cool script however, thanks. Beats having to make a plane in Blender, exporting it, importing it into Unity, etc etc. – Shivan Dragon Feb 4 '13 at 19:46