When I make an object, I generate a new MeshCollider for it based on some game parameters. It appears to get added correctly, but it doesn’t draw in the editor and it doesn’t collide with anything.
If I go to the component in the inspector and check any of the toggle boxes, it both appears and starts working. I then turn the checkbox back off so it is just like I want it and it still works.
So it isn’t the checkbox’s setting that is fixing it, it is the act of changing anything that makes it wake up. Am I adding the collider wrong? Is there an extra step?
go.AddComponent( typeof( MeshCollider ) );
.
.
MeshCollider tCollider = transform.gameObject.GetComponent( typeof( MeshCollider ) ) as MeshCollider;
tCollider.sharedMesh = new Mesh();
tCollider.sharedMesh.vertices = tVertices;
tCollider.sharedMesh.triangles = tTriangles;