Skip to content

Layer

Updated

Puts the entity on a render/raycast layer so cameras and rays can include or skip it.

Type
comp-layer
Script class
LayerComponent
Per entity
One
Version
1.0.0
Enable
Always on

Read about it in Common components: 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
layer 0 ≤ x ≤ 20, integer

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

  • Layer::change

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