engine: TypeError: this.canvas.getBoundingClientRect is not a function problem
I’m using PlayCanvas 1.24.0-dev, Firefox browser This is my error when I test samples:
TypeError: this.canvas.getBoundingClientRect is not a function playcanvas.js:5089:35
updateClientRect playcanvas.js:5089
GraphicsDevice playcanvas.js:4607
Application playcanvas.js:22962
P/S: Chome browser is not working with the same error
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (7 by maintainers)
Put your code in
window.onloadorloadevent listener, the<canvas>probably doesn’t exist at the moment you execute that script (e.g. in<head>)Closing this because it looks like a bug in the reporter’s code.
Works too, but I prefer to make my JS/TS code independent from whatever is in your HTML files. Doesn’t matter then if you spawn one instance or ten, everything is nicely encapsulated: