-
Notifications
You must be signed in to change notification settings - Fork 1
Selection
Namespace: WIDVE.Utilities
Location: WIDVE Unity Scripts/Utilities/Selection
The Selection family of scripts provide ways to target and select various objects in the scene. There is also functionality for highlighting objects that can be selected.
This interface allows components to be selected. Components must implement the Select
method, which is triggered when they are selected.
This interface lets components react to a Selector hovering over them, but not selecting them. The StartHighlight
method is called when a Selector
begins hovering over an object, and the EndHighlight
methos is called when the Selector
moves away.
The OnSelect
component can be used to trigger a simple UnityEvent
in response to a selection. This is the best method to set up a quick selectable object in the Inspector.
The Selector
component is an abstract class that is used for selecting and highlighting objects in the scene. Any components used for selection should inherit from Selector
.
Property | Description |
---|---|
Layers |
Objects on these layers will be selected |
HighlightLayers |
Objects on these layers will be highlighted |
SeparateHighlightLayers |
If this is unchecked, HighlightLayers is unused. Instead, the Layers layer mask is used for both selection and highlighting |
TriggerButton |
A ButtonFloat that is used to activate a selection |
TriggerThreshold |
When the TriggerButton exceeds this value, a selection is triggered |
A component that inherits from Selector
. The LaserPointer
is used to select objects using a simple pointer interface. Any objects in range that are pointed to will be selected or highlighted using a RayCast. The ProcessSelection
method of this component serves as a good example of how to implement a custom Selector
.
Property | Description |
---|---|
Range |
The maximum range of the pointer's RayCast |
Visual |
The LaserPointerVisual component that this LaserPointer uses |
The LaserPointerVisual
component updates the LaserPointer's
visual representation when pointing at objects. It could be used with other Selectors
as well.
Property | Description |
---|---|
Line |
The LineRenderer used for the laser |
HitMaterial |
Material to use when the LaserPointer is pointing at an object |
NoHitMaterial |
Material to use when the LaserPointer is pointing at nothing |
ExtendToTarget |
If checked, the laser will extend in length to touch any objects that are pointed at |
LineLength |
The line length to use when the laser pointer is not extending to an object |