Combine meshes in Unity

Do you want to combine meshes into one single mesh in Unity? This tutorial explains how to use unity's CombineMeshes function to do that.


using System.Collections.Generic;
using UnityEngine;

public class App : MonoBehaviour
    public Mesh Mesh1;
    public Mesh Mesh2;

    private void Start()
        var mesh = CombineMeshes(new List<Mesh> { Mesh1, Mesh2 });
        GetComponent<MeshFilter>().mesh = mesh;

    private Mesh CombineMeshes(List<Mesh> meshes)
        var combine = new CombineInstance[meshes.Count];
        for (int i = 0; i < meshes.Count; i++)
            combine[i].mesh = meshes[i];
            combine[i].transform = transform.localToWorldMatrix;

        var mesh = new Mesh();
        return mesh;


GrĂ¼sse aus Berlin!
This is a cookie free and popup free website.
Join me in making the web enjoyable again by removing the need for annoying cookie warnings and silly newsletter overlays!