UI Menu
Updated
Opens a popup menu when clicked.
- Type
comp-ui-menu- Script class
UIMenuComponent- Per entity
- One
- Version
- 1.2.0
Read about it in Controls: 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 |
|
borderWidth |
||
borderWidth[] |
0 ≤ x ≤ 16384 |
|
gap |
0 ≤ x ≤ 16384 |
|
minWidth |
0 ≤ x ≤ 16384 |
|
offset |
- |
|
opacity |
0 ≤ x ≤ 1 |
|
padding |
||
padding[] |
0 ≤ x ≤ 16384 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
UIMenu::openUIMenu::close
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
A File menu with three UI Menu Items, a tooltip added by a script, and an in-scene QWERTY UI Keyboard whose key presses play a click.
Rest the pointer on File to see its tooltip, press it and choose an entry: the log names it. Click the note field and press keys on the in-scene keyboard to hear them click. Drag outside the panel 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(UIMenuComponent); if (component) log(component.props);}