# solved Getting error BABYLON.GUI.AdvancedDynamicTexture is undefined

## Recommended Posts

Hello,

I was trying the http://playground.babylonjs.com/#E0WY4U#, demo and clicked the 'zip' button to save the source files.

I then tried to hit the saved pages using local webserver, but I was getting exception (see the attached file).

The generated index.html (also attached here) has the following external references:

<title>Babylon.js sample code</title>
<!-- Babylon.js -->
<script src="https://www.babylonjs.com/hand.minified-1.2.js"></script>
<script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
<script src="https://preview.babylonjs.com/cannon.js"></script>
<script src="https://preview.babylonjs.com/oimo.js"></script>
<script src="https://preview.babylonjs.com/babylon.js"></script>

Looks like some GUI type is not defined, I guess the included gui.js is not correct ?

index.html

##### Share on other sites

Hi @HoloLite

Babylon GUI is an extention and must be included After the babylon.js file.
this is a bug in the sample download, a fix is on the way but for now just move babylon.js line above babylon.gui.js like shown below

  <script src="https://www.babylonjs.com/hand.minified-1.2.js"></script>
+ <script src="https://preview.babylonjs.com/babylon.js"></script>
<script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
<script src="https://preview.babylonjs.com/cannon.js"></script>
<script src="https://preview.babylonjs.com/oimo.js"></script>
- <script src="https://preview.babylonjs.com/babylon.js"></script>

##### Share on other sites

Ah yes I just noticed that too. Thanks for the tip!

Now it's working... however the controllers are not showing.

Looking at the errors, it looks like it can't download the controller assets ? Any ideas ?

##### Share on other sites

404 means that the meshes aren't being loaded, but they are at that URL.  My guess is that it is CORS related or file:// policy.  You can get those meshes from github and put on your server:
https://github.com/BabylonJS/Babylon.js/tree/master/assets/meshes/controllers/microsoft/045E-065B

edit: WindowsMotionController.MODEL_BASE_URL So, at least when loading file://, I think you could do:

BABYLON.WindowsMotionController.MODEL_BASE_URL = '/myfolder/'

##### Share on other sites

@brianzinn thanks for the feedback.

I did try your suggestion. I copied the assets dir (including the meshes dir) onto my local web server.

In my local web server's root directory, the file 'assets\meshes\controllers\microsoft\045E-065B\right.glb' or left glb actually exists.

Then I set:

BABYLON.WindowsMotionController.MODEL_BASE_URL = "/assets/meshes/controllers/microsoft/";

But I am still getting the 404 error, even though the actual path to the .glb file actually exists. Any idea what went wrong ?

##### Share on other sites

Hello!

This is because the Windows MR controllers are using glTF. It's also an extension you have to reference. I thought we had a warning message but apparently we didn't  cc @Deltakosh

In conclusion, to make my sample works on your machine you need :

- to download or reference our GUI extension library as it's not in the core of Babylon.js

Thanks!

David

##### Share on other sites

@davrous Yes it worked now. This is awesome! Thank you for the help!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.