Skip to main content

GameControllerModule.ButtonInputEvent

Class

Fired when a button is pressed or released on a connected controller.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
1 platform note
  • SnapchatNot supported — Available on SPECS only
  • SPECSFully supported
    • Experimental API; it may change or be removed.
  • Camera Kit WebNot supported — Available on SPECS only
  • Camera Kit MobileNot supported — Available on SPECS only

Platform details

  • Snapchat — Not supported — Available on SPECS only.

  • SPECS — Fully supported. Experimental API; it may change or be removed

  • Camera Kit Web — Not supported — Available on SPECS only.

  • Camera Kit Mobile — Not supported — Available on SPECS only.

Since Lens Scripting v373Experimental

Fired when a button is pressed or released on a connected controller.

Index

Example

//@input Asset.GameControllerModule gameControllerModule
var provider = script.gameControllerModule.createController();
provider.onButtonEvent.add(function(event) {
print("Button " + event.button + " (" + event.eventType + ") on controller " + event.controllerId);
});

Extends

Properties

button

readonly button: Button

ExperimentalSPECS

Which button changed state.

Since

Lens Scripting Version 373


controllerId

readonly controllerId: number

ExperimentalSPECS

Unique identifier of the controller that produced the event.

Since

Lens Scripting Version 373


eventType

readonly eventType: ButtonEventType

ExperimentalSPECS

Whether the button was pressed or released.

Since

Lens Scripting Version 373


timestamp

readonly timestamp: number

ExperimentalSPECS

Timestamp of the event in milliseconds (steady system clock).

Since

Lens Scripting Version 373

Methods

getTypeName()

static getTypeName(): TypeName<ButtonInputEvent>

ExperimentalSPECS

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<ButtonInputEvent>

Since

Lens Scripting Version 373

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Experimental

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Experimental

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Experimental

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame