Decal
Updated
Stamps an image onto every surface inside its box, like a sticker.
- Type
comp-decal- Script class
DecalComponent- Per entity
- One
- Version
- 2.0.0
Read about it in Decals: 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 |
|---|---|---|
color |
"#ffffff" |
|
opacity |
1 |
0 ≤ x ≤ 1 |
type |
"fixed" |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Leave scorch marks where the player clicks the floorEach click on the floor copies a disabled template Decal with spawn, turned to project straight down, at a random angle and opacity; past twenty marks the oldest is destroyed.
Click the floor to leave marks. 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(DecalComponent); if (component) log(component.props);}