Class MeshSelection
Provides helper functions for selecting Unity objects and ProBuilder mesh elements.
Inherited Members
Namespace: UnityEditor.ProBuilder
Syntax
[InitializeOnLoad]
public static class MeshSelection
Properties
activeMesh
Gets the ProBuilder mesh on the active selected GameObject.
Declaration
public static ProBuilderMesh activeMesh { get; }
Property Value
| Type | Description |
|---|---|
| ProBuilderMesh |
bounds
Gets the axis-aligned bounding box encompassing the selected elements.
Declaration
public static Bounds bounds { get; }
Property Value
| Type | Description |
|---|---|
| Bounds |
deep
Gets all selected ProBuilderMesh components, including those on the children of selected objects.
Declaration
public static IEnumerable<ProBuilderMesh> deep { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<ProBuilderMesh> | All selected ProBuilderMesh components, including those on the children of selected objects. |
selectedEdgeCount
Gets the sum of all currently selected edges on all currently selected ProBuilderMesh objects.
Declaration
public static int selectedEdgeCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
selectedFaceCount
Gets the sum of all currently selected faces on all currently selected ProBuilderMesh objects.
Declaration
public static int selectedFaceCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
selectedObjectCount
Gets how many ProBuilderMesh components are currently selected.
Declaration
public static int selectedObjectCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
selectedSharedVertexCount
Gets the sum of all currently selected shared vertices on all currently selected ProBuilderMesh objects.
Declaration
public static int selectedSharedVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
See Also
selectedVertexCount
Gets the sum of all currently selected vertices on all currently selected ProBuilderMesh objects.
Declaration
public static int selectedVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
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> |
totalCommonVertexCount
Gets the number of all selected vertices across the selected ProBuilder meshes, excluding coincident duplicates.
Declaration
public static int totalCommonVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
totalEdgeCount
Gets the sum of all selected ProBuilderMesh edges.
Declaration
public static int totalEdgeCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
totalFaceCount
Gets the sum of all selected ProBuilderMesh faces.
Declaration
public static int totalFaceCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
totalTriangleCountCompiled
Gets the sum of all selected ProBuilder compiled mesh triangles (3 indices make up a triangle, or 4 indices if topology is quad).
Declaration
public static int totalTriangleCountCompiled { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
totalVertexCount
Gets the sum of the vertices across all selected meshes.
Declaration
public static int totalVertexCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Remarks
This is vertexCount, not vertexCount.
Methods
ClearElementAndObjectSelection()
Clears both the objects and ProBuilder mesh attribute selections.
Declaration
public static void ClearElementAndObjectSelection()
See Also
ClearElementSelection()
Clears all selected mesh attributes in the current selection. This means triangles, faces, and edges, but not objects.
Declaration
public static void ClearElementSelection()
See Also
Events
objectSelectionChanged
Raised when the object selection changes.
Declaration
public static event Action objectSelectionChanged
Event Type
| Type | Description |
|---|---|
| Action |