Search Unity

ProBuilder Auto UV creates larger Mesh vertices than original model

Discussion in 'World Building' started by unitynewb, May 16, 2021.

  1. unitynewb

    unitynewb

    Joined:
    Feb 22, 2009
    Posts:
    243
    Anyone have a work around for this? The model looks exactly the same, but the vertices expand by more than double after I call import. This is what I'm using to import the mesh:
    Code (CSharp):
    1.  
    2.         var importer = new MeshImporter(objectToProbuilderize.gameObject);
    3.         importer.Import();
    4.  
    I think the issue appears when I try to fix the UVMap, this is where it creates more vertices:

    Code (CSharp):
    1.  
    2.                     AutoUnwrapSettings setting = new AutoUnwrapSettings();
    3.                     setting.fill = AutoUnwrapSettings.Fill.Tile;
    4.                     setting.anchor = AutoUnwrapSettings.Anchor.None;
    5.                     setting.offset = Vector2.zero;
    6.                     setting.useWorldSpace = true;
    7.                     setting.scale = Vector2.one;
    8.                     foreach (Face F in pb_mesh.faces)
    9.                     {
    10.                         F.manualUV = false;
    11.                         //F.textureGroup = 1;
    12.                         F.uv = setting;
    13.                     }
    14.                     pb_mesh.ToMesh();
    15.                     pb_mesh.Refresh();
    Preferably there's a way to create the ProBuilderMesh/Fix UVS and keep the same Mesh Data.
     
    Last edited: May 16, 2021