# Uncaught TypeError: n.getEngine(...).getInputElement is not a function

**URL:** <https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013>\
**Category:** Bugs\
**Created:** [March 5, 2020, 4:41pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013 "2020-03-05T16:41:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuxin](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@yuxin](https://forum.babylonjs.com/u/yuxin)\
**Post date:** [March 5, 2020, 4:41pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/1 "2020-03-05T16:41:05Z")

</div>

Hi, I am using BabylonJS to build 360 video player. And my player could work. However, recently I get an error which prevents my player from playing 360 videos. The error is:

Uncaught TypeError: n.getEngine(…).getInputElement is not a function  
at new e (babylon.gui.min.js:16)  
at Function.e.CreateFullScreenUI (babylon.gui.min.js:16)  
at createScene (my javascript)

This error prevents the player from rendering video, but sound of the video can be played. Since when I used this function at the very beginning it could work, I think this babylon.gui.min.js must have been updated or modified. So please help me to solve this problem.  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 5, 2020, 4:47pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/2 "2020-03-05T16:47:03Z")

</div>

We would need a repro in order to help here as it sounds impossible without it. Could you create a little playground for it ?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 5, 2020, 4:48pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/3 "2020-03-05T16:48:27Z")

</div>

It looks like your scene does not have an associated engine which is really strange

---

<div class="post-metadata">

**Author:** ![yuxin](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@yuxin](https://forum.babylonjs.com/u/yuxin)\
**Post date:** [March 5, 2020, 5:27pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/4 "2020-03-05T17:27:29Z")

</div>

Thanks for responding. Please check the repo: [Babylon.js Playground](https://www.babylonjs-playground.com/#AG3HZN)

The error occurs at line 42, which previously worked very well.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 5, 2020, 5:31pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/5 "2020-03-05T17:31:02Z")

</div>

But here this is not code compatible with the playground, the idea is that you create a small easy way for us to reproduce the issue.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 5, 2020, 5:33pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/6 "2020-03-05T17:33:19Z")

</div>

The playground already defines a number of things for you (canvas, engine, …).

Here’s your sample updated so that it works in the playground:

[https://www.babylonjs-playground.com/#AG3HZN#1](https://www.babylonjs-playground.com/#AG3HZN#1)

The video does work here.

---

<div class="post-metadata">

**Author:** ![yuxin](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@yuxin](https://forum.babylonjs.com/u/yuxin)\
**Post date:** [March 5, 2020, 6:43pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/7 "2020-03-05T18:43:11Z")

</div>

Thanks. But I need those things for my own webpage. Also, there are more than one player in a page, so I need to parse those parameters to that function. Even though I change the line 42 from the original one to the new one, that problem still exists. So I decided to delete that line and not use 2D GUI currently.

---

<div class="post-metadata">

**Author:** ![cheemcheem](https://avatars.discourse-cdn.com/v4/letter/c/b77776/32.png) [@cheemcheem](https://forum.babylonjs.com/u/cheemcheem)\
**Post date:** [March 10, 2020, 8:38pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/8 "2020-03-10T20:38:47Z")

</div>

I’m having a very similar issue!

I’m using TypeScript to write my code and Webpack to bundle it, and the webpage worked fine until I tried to add the babylonjs-gui package and use AdvancedDynamicTexture. Ever since then I get the same uncaught TypeError that you do.

I’m still looking for a solution so I’ll let you know if I find one

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 10, 2020, 8:48pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/9 "2020-03-10T20:48:33Z")

</div>

We need a repro to be able to help here. Unfortunately without it, it is hard to determine if it is an error in your code or in your webpack config ☹

---

<div class="post-metadata">

**Author:** ![cheemcheem](https://avatars.discourse-cdn.com/v4/letter/c/b77776/32.png) [@cheemcheem](https://forum.babylonjs.com/u/cheemcheem)\
**Post date:** [March 10, 2020, 8:51pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/10 "2020-03-10T20:51:18Z")

</div>

I fixed my issue! I wasn’t passing my scene to the constructor of AdvancedDynamicTexture.CreateFullscreenUI.

So my code used to say: `AdvancedDynamicTexture.CreateFullscreenUI("help");` (which didn’t work)  
And it now says: `AdvancedDynamicTexture.CreateFullscreenUI("help", undefined, this.scene);` (which works!)

Hopefully that helps

---

<div class="post-metadata">

**Author:** ![cheemcheem](https://avatars.discourse-cdn.com/v4/letter/c/b77776/32.png) [@cheemcheem](https://forum.babylonjs.com/u/cheemcheem)\
**Post date:** [March 10, 2020, 8:59pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/11 "2020-03-10T20:59:29Z")

</div>

For reference, the fixed file is on my [GitHub](https://github.com/cheemcheem/rubiks-cube-solver/blob/71e926646c8b7c9f0881c85ac233572772047c16/src/main/js/app/utilities/SceneHandler.ts#L80). (I followed the [BabylonJS/ReactJS](https://doc.babylonjs.com/resources/babylonjs_and_reactjs) guide, then converted it into TypeScript, added my own functionality, and changed the existing boilerplate code).

---

<div class="post-metadata">

**Author:** ![gsanta](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gsanta/32/10846_2.png) [@gsanta](https://forum.babylonjs.com/u/gsanta)\
**Post date:** [September 4, 2020, 9:53pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/12 "2020-09-04T21:53:24Z")

</div>

I have the same problem, even when I explicitly pass in the scene.  
What worked for me is setting the input element for the engine (but it is a big hack so I’m not happy with it):

```
const canvas = document.getElementsByTagName('canvas')[0]
const engine = new Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true })
engine.getInputElement = () => canvas
```

---

<div class="post-metadata">

**Author:** ![GeraldoOfTheRiviera](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/geraldooftheriviera/32/20993_2.png) [@GeraldoOfTheRiviera](https://forum.babylonjs.com/u/GeraldoOfTheRiviera)\
**Post date:** [October 7, 2020, 3:35pm UTC](https://forum.babylonjs.com/t/uncaught-typeerror-n-getengine-getinputelement-is-not-a-function/9013/13 "2020-10-07T15:35:55Z")

</div>

I had this issue, what worked for me was make sure both the babylonjs version and babylonjs gui version were up to date. I had an old version of babylonjs, and a newer version of babylonjs gui 😁
