Preparing search index...

    Class GameControllerSessionExperimental

    Represents an active game controller session. Exposes event properties to subscribe to controller input and lifecycle changes, plus methods to query connected controllers and trigger haptic feedback. Obtained by calling GameControllerModule.createController. Subscribe to events via the on* properties (e.g. onButtonEvent.add(handler)).

    Lens Scripting Version 373

    //@input Asset.GameControllerModule gameControllerModule
    var session = script.gameControllerModule.createController();
    session.onButtonEvent.add(function(event) {
    print("Button " + event.button);
    });
    session.getConnectedControllers().forEach(function(controller) {
    print("Connected: " + controller.name);
    });

    Hierarchy (View Summary)

    Index

    Properties

    onAnalogStickEvent: event1<AnalogStickInputEvent, void>

    Event fired when a stick's axis values change.

    Lens Scripting Version 373

    onAnalogTriggerEvent: event1<AnalogTriggerInputEvent, void>

    Event fired when a trigger's analog axis value changes.

    Lens Scripting Version 373

    onButtonEvent: event1<ButtonInputEvent, void>

    Event fired when a button is pressed or released on any connected controller.

    Lens Scripting Version 373

    onControllerConnected: event1<ControllerConnectedEvent, void>

    Event fired when a new game controller is connected. Use .add() to subscribe.

    Lens Scripting Version 373

    onControllerDisconnected: event1<ControllerDisconnectedEvent, void>

    Event fired when a game controller is disconnected. Use .add() to subscribe.

    Lens Scripting Version 373

    onMotionEvent: event1<MotionInputEvent, void>

    Event fired when motion sensor data is received. Only on motion-capable controllers.

    Lens Scripting Version 373

    onTouchpadEvent: event1<TouchpadInputEvent, void>

    Event fired when touchpad input is received. Only on controllers with a touchpad.

    Lens Scripting Version 373

    Methods

    • Experimental

      Returns an array of ControllerInfo objects describing each currently connected game controller.

      Returns ControllerInfo[]

      Lens Scripting Version 373

    • Experimental

      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 string

      Lens Scripting Version 373

    • Experimental

      Returns the name of this object's type.

      Returns string

    • Experimental

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

      Parameters

      • type: string

      Returns boolean

    • Experimental

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

      Parameters

      Returns boolean

    • Experimental

      Triggers haptic feedback (rumble) on the specified controller. Intensity values range from 0.0 (off) to 1.0 (max); duration is in seconds.

      Parameters

      Returns void

      Lens Scripting Version 373