Skip to content

Snap Zone

Updated

A box that snaps media into a neat grid.

Type
comp-snap-zone
Script class
SnapZoneComponent
Per entity
One
Version
1.0.0

Read about it in Snap zones: 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
capacity 1 ≤ x ≤ 256, integer
columns 1 ≤ x ≤ 256, integer
depth 0 ≤ x ≤ 10000
gap 0 ≤ x ≤ 10000
height 0 ≤ x ≤ 10000
margin 0 ≤ x ≤ 10000
snap 0 ≤ x ≤ 10000
width 0 ≤ x ≤ 10000

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

  • SnapZone::snap
  • SnapZone::unsnap
  • SnapZone::change
  • SnapZone::resize

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(SnapZoneComponent);
if (component) log(component.props);
}