- Home /
Issues changing a mesh collider in edit mode
I'm changing a mesh collider in edit mode using an editor script that feeds a procedural mesh to it. It works well but after a minute or so even on idle my console starts to get spammed with physics errors.
Here's how I update the mesh collider:
meshCol.sharedMesh = null;
meshCol.sharedMesh = mesh;
These are the errors I get:
Unable to create broadphase entity. UnityEngine.MeshCollider:set_sharedMesh(Mesh)
Actor Initialisation failed: returned NULL. UnityEngine.MeshCollider:set_sharedMesh(Mesh)
Could not create actor. Maybe you are using too many colliders or rigidbodies in your scene? UnityEngine.MeshCollider:set_sharedMesh(Mesh)
Is this a bug? is there a workaround?
If I enter and exit play mode the errors go away and then come back after a $$anonymous$$ute of so, I got 6 mesh colliders in my scene.
Turns out the issue was with a different editor script which was set as the parent of the colliders in the hierarchy. This editor script was setting the object dirty every inspector update which somehow caused this issue.