Skip to content

scene.gameController ​

Properties ​

controllers read-only ​

  • Type: Array<GameController>
  • Connected controllers, in connection order.

Methods ​

off() ​

javascript
scene.gameController.off(id: string): void

Remove a subscription made with on.

Parameters:

  • id (string) - Id returned from on.

Returns: void

on() ​

javascript
scene.gameController.on(type: string, listener: any): string | any

Subscribe to controllers connecting or disconnecting. Controllers that are already connected fire connect for a new subscriber on the next frame, never inside on. Subscriptions end when the scene changes.

Example:

javascript
if (environment.features.has('gameController')) {
    scene.gameController.on('connect', function (controller) {
        console.log('Connected: ' + controller.name);
    });
}

Parameters:

  • type (string) - "connect" or "disconnect".
  • listener (any)

Returns: string | any