Monthly Archives: April 2016

Unity3D Mesh Collider vs. Box Collider

Logic tells us that a box collider in Unity3D will be more performant than a mesh collider simply because it is less complex. But I had an impulse a couple days ago to test it out myself. This doesn’t really scratch the surface of every use-case.

I went to the AssetStore and picked out a fairly simple free armchair model. I then made two different prefabs, one with a convex mesh collider, and the other with a box collider.

Chair collidersThen I made a script to spawn a 40×40 grid of a type and let them fall onto two planes. That means a total of 1600 armchairs were doing discrete physics updates, which will kill even the best of the PC master-race.


On the left side we have the mesh collider, and on the right is the box collider. Click the gif to goto a full-size version which has a bar to manually scrub through.

As expected, the summary is that the mesh collider is incredibly slower (sometimes even 20x slower) than the box collider. And in this case the mesh collider is actually pretty simple. Something worth pointing out is that although the graphs sort of line up, their scale is totally different, so take a proper look at the number on it.


Now for bonus points, here is a pretty scene of a stupid amount of spheres attacking the streets of New York.

Nuget: Your project.json doesn’t list ‘win10-x86’ as a targeted runtime

Recently I was working on a small UWP app on my SurfaceBook and everything was fine. But when I pulled the code from GitHub down to my main machine I got the following error:

Your project.json doesn’t list ‘win10-x86’ as a targeted runtime. You should add ‘”win10-x86″: { }’ inside your “runtimes” section in your project.json, and then re-run NuGet restore. 

After a while I figured out that this error is totally misleading, and the real problem is that your Nuget package source has been disabled. I have a feeling this was related to installing Visual Studio 15 preview.

Anyway, to fix it: Click Tools > Options > NuGet Package Manager > Package Sources, and then re-enable (or re-add) the sources.NuGet Package Manager