Search Unity

[API] how to group faces through the API?

Discussion in 'World Building' started by SgtLame, Aug 20, 2021.

  1. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi everyone!
    With the ProBuilder API, I need to do the same operation as a "group selected faces" in the UV editor.
    Is it possible? I couldn't find anything in the API doc.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,743
    Looking at the ProBuilder source code from the package, in the
    AutoUVEditor.cs
    file, I see this:

    Code (csharp):
    1.             if (GUILayout.Button(gc_GroupSelected))
    2.             {
    3.                 for (int i = 0; i < selection.Length; i++)
    4.                     TextureGroupSelectedFaces(selection[i]);
    5.  
    6.                 ProBuilderEditor.Refresh();
    7.             }
    I would start there, and dig into:

    Code (csharp):
    1.         private static void TextureGroupSelectedFaces(ProBuilderMesh pb)//, pb_Face face)
    2.  
     
    SgtLame likes this.
  3. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Thanks, will try!