Skip to content

UI Drawing

Updated

A canvas scripts can draw on: paint, minimaps, charts.

Type
comp-ui-drawing
Script class
UIDrawingComponent
Per entity
One
Version
1.1.0

Read about it in Content: 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
borderRadius
borderRadius[] 0 ≤ x ≤ 16384
height 0 ≤ x ≤ 16384
margin
margin[] -16384 ≤ x ≤ 16384
padding
padding[] 0 ≤ x ≤ 16384
resolution 1 ≤ x ≤ 4
width 0 ≤ x ≤ 16384

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

  • UIDrawing::pointer-down
  • UIDrawing::pointer-move
  • UIDrawing::pointer-up
  • UIDrawing::pointer-hover
  • UIDrawing::pointer-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(UIDrawingComponent);
if (component) log(component.props);
}