Skip to content

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.

The props the runtime declares for this component, with their defaults and accepted ranges.

Prop Default Range
cursor true
hand true
selected false

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • Selectable::select
  • Selectable::deselect
  • Selectable::change
  • Selectable::hover
  • Selectable::leave

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(SelectableComponent);
if (component) log(component.props);
}