Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Does a ProBuilderMesh require a MeshRenderer and MeshFilter?

Discussion in 'World Building' started by sballew7, Jun 1, 2021.

  1. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    74
    Hi all,

    I currently am generating meshes from code. I am using a class called MeshDraft, which is basically just a list of vertices, triangles, and UVs that I can later use to create a Mesh.

    I create a top-level MeshDraft, then iterate over a 3d grid of "tiles". Each tile build returns its own MeshDraft, which the top-level MeshDraft then adds in to the master list. Once done, the top-level MeshDraft gets built into a Mesh and assigned to the MeshFilter.

    I want to switch to using ProBuilder for this generation. I planned on having a top-level ProBuilderMesh, and have each tile return its own ProBuilderMesh. Then I'd use a CombineMeshes operation to join it to the top-level mesh.

    However it looks like ProBuilderMesh assumes a 1-1 mapping with a MeshRenderer and MeshFilter. I don't want a renderer or filter for all the tile meshes I'm building. It also looks like just creating a ProBuilderMesh will actually create a GameObject, when really I just want to generate a bunch of meshes that ultimately get combined into the single top-level GameObject.

    Am I going against the grain by wanting to produce a bunch of ProBuilderMesh instances that all get combined into a single top-level one?

    Thanks!
     
    Last edited: Jun 1, 2021
  2. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    454
unityunity