Error: AddComponent asking for "MeshCollider" which is not a Unity engine type.

I have a problem with colliders in my game. When I play in the editor it works fine, but when I build it (WebGL) and run it in chrome the colliders don’t work at all. The Chrome console says:

AddComponent asking for "MeshCollider" which is not a Unity engine type.

Where is the problem? I’ve had a similar problem before and I solved it by enabling read/write in the prefab but that doesn’t seem to do anything now.

This helped me.

I see two possible causes:

  • You either did not include the Physics module / have removed it so the type UnityEngine.MeshCollider just doesn’t exists.
  • Or you named one of your own classes MeshCollider which will hide Unity’s one.

If it’s the first case, check your Package manager inside Unity and make sure the physics module is included.

If it’s the second case I would strongly recommend to rename your own class to something else. If you really want to keep it you have two options. Either place your own MeshCollider class into a seperate namespace. This might not always work. The second solution (which also works when the first one fails) is to use the full qualified classname which is UnityEngine.MeshCollider like so


Out of experience I would assume your issue is the second case. So you named one of your own types MeshCollider.