void MergeGrass() { //Merge objects to one mesh //MeshFilter[] meshFilters = new MeshFilter[2]; //meshFilters[0] = generatedBranch.GetComponent<MeshFilter>(); //meshFilters[1] = generatedLeaves.GetComponent<MeshFilter>(); //mergedMesh = GeneratedMesh.CombineMeshes(transform, meshFilters); MeshFilter[] meshFilters = new MeshFilter[2]; meshFilters[0] = generatedBranch.GetComponent <MeshFilter>(); meshFilters[1] = generatedLeaves.GetComponent <MeshFilter>(); mergedMesh = GeneratedMesh.CombineMeshesManyMats(transform, meshFilters); }