UI Slider
Updated
Drag to pick a value.
- Type
comp-ui-slider- Script class
UISliderComponent- Per entity
- One
- Version
- 1.1.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 |
|---|---|---|
margin |
||
margin[] |
- |
|
max |
- |
|
min |
- |
|
padding |
||
padding[] |
0 ≤ x ≤ 16384 |
|
step |
0 ≤ x ≤ 1000000000 |
|
value |
- |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
UISlider::changeUISlider::change-end
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
A settings panel whose volume slider, mute switch and reset button drive the music: UI Slider, UI Switch and UI Button events handled by one Behavior script that sets an Audio volume.
With your sound on, move the slider, flip Mute and press Reset. Drag outside the panel to orbit the camera, scroll to zoom. The music is a short loop generated for this example.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(UISliderComponent); if (component) log(component.props);}