Question by
Soos621 · Nov 24, 2016 at 05:30 PM ·
unity 5meshcombinemeshes
Unity Editor Crash when trying to combine meshes
I have a small manager that combines box meshes together in order to fix a tiled floor physics problems on edge detection. It was working fine and then the editor began to crash. I may be doing something wrong but i've narrowed it down to this function
public void AddTileToMesh (ShipFloor sp){
MeshFilter mFilter = this.GetComponent<MeshFilter> ();
MeshCollider mCol = this.GetComponent<MeshCollider> ();
Mesh newTileMesh = sp.GetComponent<MeshFilter> ().sharedMesh;
CombineInstance[] c = new CombineInstance[2];
c [0].mesh = newTileMesh;
c [0].transform = this.transform.worldToLocalMatrix * sp.transform.localToWorldMatrix;
c [1].mesh = this.GetComponent<MeshFilter>().sharedMesh;
c [1].transform = Matrix4x4.TRS (this.transform.localPosition, this.transform.localRotation, this.transform.localScale);
mFilter.sharedMesh = new Mesh ();
mFilter.sharedMesh.CombineMeshes (c);
mCol.sharedMesh = mFilter.sharedMesh;
Destroy (sp.gameObject);
}
I'm currently using the latest beta but i did already install latest stable version which didn't help. There is no bug report window when the editor crashes. Any information regarding this problem would be very helpful, thanks.
Comment
Your answer
Follow this Question
Related Questions
How can I create a plane at any given vertex position? 0 Answers
Relative positions on model animations are broken 1 Answer
Generate Polygon Plane from Array 0 Answers
blending between meshes 1 Answer
How to add manual generated color ? 0 Answers