Unity WebGL mouse problems on HTML elements

Hello Unity Forum,

Using Unity 5.5.0f3

I’m making a webgl/html hybrid app where I want the GUI to be handled in HTML.
There is a 3d model view with rotation/pan/zoom controls made in Unity, which also works in the WebGL version.

The problem is that the moment my WebGL canvas has fully loaded any html inputs relying on input events completely stop working.

I’ve already disabled the keyboard capture, but I need the webgl app to stop capturing mouse events too when it’s out of focus.

Some googling has led me to some Unity Answer posts without any answers on them.

Is there any way of doing it?

This is more of a “hit it with a hammer solution”, but you could just overwrite addEventListener to prevent unity from calling it. This may, however, break other javascripts on the page. In our case, we were using jquery and everything continued to work as normal.

window.addEventListener = function() { return true };