Class MeshSelection
Helper functions for working with Unity object selection and ProBuilder mesh attribute selections.
Namespace: UnityEditor.ProBuilder
Syntax
public static class MeshSelection
Properties
activeMesh
Declaration
public static ProBuilderMesh activeMesh { get; }
Property Value
| Type | Description |
|---|---|
| ProBuilderMesh | Returns the active selected mesh. |
bounds
Declaration
public static Bounds bounds { get; }
Property Value
| Type | Description |
|---|---|
| Bounds | An axis-aligned bounding box encompassing the selected elements. |
deep
Get all selected ProBuilderMesh components, including those in children of selected objects.
Declaration
public static IEnumerable<ProBuilderMesh> deep { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<ProBuilderMesh> | All selected ProBuilderMesh components, including those in children of selected objects. |
selectedEdgeCount
Declaration
public static int selectedEdgeCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | The sum of all selected ProBuilderMesh selected edge counts. |
selectedFaceCount
Declaration
public static int selectedFaceCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | The sum of all selected ProBuilderMesh selected face counts. |
selectedObjectCount
Declaration
public static int selectedObjectCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | How many ProBuilderMesh components are currently selected. Corresponds to the length of Top. |
selectedSharedVertexCount
Declaration
public static int selectedSharedVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | The sum of all selected ProBuilderMesh selected shared vertex counts. |
See Also
selectedVertexCount
Declaration
public static int selectedVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | The sum of all selected ProBuilderMesh selected vertex counts. |
See Also
top
Get all selected ProBuilderMesh components. Corresponds to Selection.gameObjects.Select(x => x.GetComponent<ProBuilderMesh>().Where(y => y != null);.
Declaration
public static IEnumerable<ProBuilderMesh> top { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<ProBuilderMesh> | An array of the currently selected ProBuilderMesh components. Does not include children of selected objects. |
totalCommonVertexCount
Declaration
public static int totalCommonVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | Get the number of all selected vertices across the selected ProBuilder meshes, excluding coincident duplicates. |
totalEdgeCount
Declaration
public static int totalEdgeCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | Sum of all selected ProBuilderMesh object edgeCount properties. |
totalFaceCount
Declaration
public static int totalFaceCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | Sum of all selected ProBuilderMesh object faceCount properties. |
totalTriangleCountCompiled
Declaration
public static int totalTriangleCountCompiled { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | Get the sum of all selected ProBuilder compiled mesh triangle counts (3 indexes make up a triangle, or 4 indexes if topology is quad). |
totalVertexCount
Declaration
public static int totalVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | Get the number of all selected vertices across the selected ProBuilder meshes. |
Remarks
This is the ProBuilderMesh.vertexCount, not UnityEngine.Mesh.vertexCount. To get the optimized mesh vertex count,
see totalVertexCountCompiled for the vertex count as is rendered in the scene.
Methods
ClearElementAndObjectSelection()
Clear both the Selection.objects and ProBuilder mesh attribute selections.
Declaration
public static void ClearElementAndObjectSelection()
ClearElementSelection()
Clears all selected mesh attributes in the current selection. This means triangles, faces, and edges, but not objects.
Declaration
public static void ClearElementSelection()
Events
objectSelectionChanged
Declaration
public static event Action objectSelectionChanged
Event Type
| Type | Description |
|---|---|
| Action | Receive notifications when the object selection changes. |