Skip to content

Screen Gamepad

Updated

An on-screen gamepad with two sticks and four buttons, for touch screens.

Type
comp-screen-gamepad
Script class
ScreenGamepadComponent
Per entity
One
Version
1.0.0

Read about it in Screen Gamepad: 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
opacity 0 ≤ x ≤ 1
padding[] 0 ≤ x ≤ 10000
scale 0 ≤ x ≤ 1

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

  • ScreenGamepad::press
  • ScreenGamepad::release

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(ScreenGamepadComponent);
if (component) log(component.props);
}