Event or actions not triggering

Hello there,

I’m trying to hook up some events in my game but they are not working for some reason. They work fine in the PG (Babylon.js Playground) but not inside my game.

Any event related code won’t trigger. For example the following code

this._scene.onPointerDown = function (event, pickInfo) {
if (pickInfo.hit) {
alert(‘player clicked’);

The game runs on a browser, so I was wondering if something else was maybe blocking or preventing events from happening, like the fullscreen UI i have, or maybe the detach controls, but even after disabling them I still don’t get any events.

Any ideas what it might be?

Happy holidays!

Hmmm could you check if your canvas is receiving mouse events?

is this._scene not pointing to the correct thing maybe? Only thing I can think of or maybe you have some dom element over your canvas eating the input?

1 Like

Thanks for the help. I had indeed another canvas sitting on top that I’m using as a loading bar, but since I was setting the opacity to 0 I thought it wouldn’t block the inputs, but it does.

Happy new year!

1 Like