Class SelectionPicker
Provides functions for picking mesh elements in a view. This allows the Editor to either render a texture to test, or cast a ray.
Inherited Members
Namespace: UnityEngine.ProBuilder
Assembly: Unity.ProBuilder.dll
Syntax
public static class SelectionPicker
Methods
PickEdgesInRect(Camera, Rect, IList<ProBuilderMesh>, PickerOptions, float)
Picks the Edge objects contained within a rect (rectangular selection).
Declaration
public static Dictionary<ProBuilderMesh, HashSet<Edge>> PickEdgesInRect(Camera cam, Rect rect, IList<ProBuilderMesh> selectable, PickerOptions options, float pixelsPerPoint = 1)
Parameters
Type | Name | Description |
---|---|---|
Camera | cam | Use this camera to evaluate whether any edge object(s) are inside the |
Rect | rect | Rect is in GUI space, where 0,0 is the top left of the screen, and |
IList<ProBuilderMesh> | selectable | The collection of objects to check for selectability. ProBuilder verifies whether these objects fall inside the |
PickerOptions | options | The options that define whether to include mesh elements that are hidden and whether to consider elements that only partially fall inside the |
float | pixelsPerPoint | Scale the render texture to match |
Returns
Type | Description |
---|---|
Dictionary<ProBuilderMesh, HashSet<Edge>> | A dictionary of ProBuilderMesh and Edge objects that are in the selection |
PickFace(Camera, Vector3, ProBuilderMesh)
Returns the first face on a ProBuilder mesh that collides with the ray cast by ProBuilder, given a specific screen position and camera.
Declaration
public static Face PickFace(Camera camera, Vector3 mousePosition, ProBuilderMesh pickable)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to use when calculating the raycast. |
Vector3 | mousePosition | The screen position to use when calculating the raycast. |
ProBuilderMesh | pickable | The ProBuilderMesh to test for the ray/face intersection. |
Returns
Type | Description |
---|---|
Face | The intersected face if successful; null if the ray failed to hit a face. |
PickFacesInRect(Camera, Rect, IList<ProBuilderMesh>, PickerOptions, float)
Picks the Face objects contained within a rect (rectangular selection).
Declaration
public static Dictionary<ProBuilderMesh, HashSet<Face>> PickFacesInRect(Camera cam, Rect rect, IList<ProBuilderMesh> selectable, PickerOptions options, float pixelsPerPoint = 1)
Parameters
Type | Name | Description |
---|---|---|
Camera | cam | Use this camera to evaluate whether any face object(s) are inside the |
Rect | rect | Rect is in GUI space, where 0,0 is the top left of the screen, and |
IList<ProBuilderMesh> | selectable | The collection of objects to check for selectability. ProBuilder verifies whether these objects fall inside the |
PickerOptions | options | The options that define whether to include mesh elements that are hidden and whether to consider elements that only partially fall inside the |
float | pixelsPerPoint | Scale the render texture to match |
Returns
Type | Description |
---|---|
Dictionary<ProBuilderMesh, HashSet<Face>> | A dictionary of ProBuilderMesh and Face objects that are in the selection |
PickVerticesInRect(Camera, Rect, IList<ProBuilderMesh>, PickerOptions, float)
Picks the vertex indices contained within a rect (rectangular selection).
Declaration
public static Dictionary<ProBuilderMesh, HashSet<int>> PickVerticesInRect(Camera cam, Rect rect, IList<ProBuilderMesh> selectable, PickerOptions options, float pixelsPerPoint = 1)
Parameters
Type | Name | Description |
---|---|---|
Camera | cam | Use this camera to evaluate whether any vertices are inside the |
Rect | rect | Rect is in GUI space, where 0,0 is the top left of the screen, and |
IList<ProBuilderMesh> | selectable | The collection of objects to check for selectability. ProBuilder verifies whether these objects fall inside the |
PickerOptions | options | The options that define whether to include mesh elements that are hidden and whether to consider elements that only partially fall inside the |
float | pixelsPerPoint | Scale the render texture to match |
Returns
Type | Description |
---|---|
Dictionary<ProBuilderMesh, HashSet<int>> | A dictionary of ProBuilderMesh and sharedIndexes that are in the selection |