Selectable
Updated
Makes the entity selectable with a click or hand touch.
- Type
comp-selectable- Script class
SelectableComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Selection and grabbing: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
cursor |
true |
|
hand |
true |
|
selected |
false |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
Selectable::selectSelectable::deselectSelectable::changeSelectable::hoverSelectable::leave
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Pop when clickedA box that grows and settles back with a bounce when clicked: two awaited Tweens on its scale, started from a Selectable event.
Click the box. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(SelectableComponent); if (component) log(component.props);}