Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Probuilder - Merge faces in RunTime?

Discussion in 'World Building' started by philc_uk, Oct 19, 2020.

  1. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    Hi,

    How would I merge 2 faces at runtime? Theres seems to be a editor tool command, but no RunTime c# API to acheive this - only merge meshes, but that leaves the faces seperate - I want the faces to be merged (ideally the ones that face the same way instead of sperate ones)

    Thanks!
     
  2. paweldev

    paweldev

    Joined:
    May 7, 2017
    Posts:
    1
    ProBuilderMesh mesh = ProBuilderMesh.Create(vertices, faces);
    Face face = MergeElements.Merge(mesh, mesh.faces);

    mesh.ToMesh();
    mesh.Refresh();
    mesh.Optimize();