Multi canvas scene.attachControl() broken on 5.0.0-beta.4

Noticed this bug/issue while migrating from 5.0.0-alpha.14 to 5.0.0-beta.7
Seems to be introduced on 5.0.0-beta.4, previous versions work as expected.

scene.attachControls() no longer working when using multi canvases and defining inputElement after scene is initialized. Events are not captured.

Unfortunately I can’t use the playground in order to demo the multi canvas approach, so please bear with me.


  1. Create the engine with a working canvas, initialize the scene and camera
var canvas = document.createElement("canvas");
var engine = new BABYLON.Engine(canvas, true);
var scene = new BABYLON.Scene(engine);
var camera = ...
  1. Use engine.registerView for the actual canvas element for output
engine.registerView(outputCanvas, camera, true);
  1. Following instructions here, attach controls - last line doesn’t work, no events captured, no errors
engine.inputElement = outputCanvas;

cc @PolygonalSun

This issue came up from a recent change to the InputManager. The fix is currently in PR: DeviceInputSystem: Add configure/removeEvents to be called by DeviceSourceManager by PolygonalSun · Pull Request #11959 · BabylonJS/Babylon.js (


PR is merged