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.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
borderRadius |
||
border |
0 ≤ x ≤ 16384 |
|
height |
0 ≤ x ≤ 16384 |
|
margin |
||
margin[] |
- |
|
padding |
||
padding[] |
0 ≤ x ≤ 16384 |
|
resolution |
1 ≤ x ≤ 4 |
|
width |
0 ≤ x ≤ 16384 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
UIDrawing::pointer-downUIDrawing::pointer-moveUIDrawing::pointer-upUIDrawing::pointer-hoverUIDrawing::pointer-leave
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A round minimapEvery frame a script redraws a round UI Drawing in the corner of the screen with a dot at the player's position on a 40 m map.
Watch the red dot on the minimap follow the amber player around the yard. 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(UIDrawingComponent); if (component) log(component.props);}