New to BabylonJS, can't get GUI.js to work

Just joined, been experimenting with Babylon.js for a month or so now. I tried to copy some code from the playground ( ) to my machine and run it but the GUI.js file doesn’t seem to be loading correctly.

Here’s the code where it blows up:

    var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
    var colorArray = ["white", "blue", "green", "black", "red"];

    // Activate the clipboard events listener

With the error:
“Uncaught TypeError: advancedTexture.registerClipboardEvents is not a function”

Do I have to use npm and install BABYLON.GUI.js to use the GUI library?
Do I have to install webpack too?

What I tried was

which works for babylon.max.js but not the GUI…

(Been trying to learn npm and import/export but haven’t got there yet.)

thanks in advance

what I meant to say was:

What it tried was:


what I tried to do was include the files in a script tag (which won’t display here?)

Hey and welcome Larry!

Can you make sure that you are referecing GUI and Babylon.js from the same url?

<script src="">
<script src="">


thanks, that does work but fails when I change “//preview…” to “//cdn…”
for example:
"src=‘’ "
"src=‘’ "

Also, when I download these files to my local wwwroot directory the preview files work but the cdn files fail.
ClipboardText.html:97 Uncaught TypeError: advancedTexture.registerClipboardEvents is not a function

The variable “advancedTexture” is a valid instantiated object and I can see all it’s properties, but “registerClipboardEvents” does not exist in the babylon.gui.js file as loaded into the browser. (I’m using Chrome)

Does that suggest an error in the UniversalModuleDefinition ???

The code is a direct copy from the playground example:
(errors on line 29)


You have to take everything either from preview or cdn but you cannot do a mix

Yes, I took both from either CDN or PREVIEW


Oh, I case my above reply wasn’t clear, it still failed when I took them both from CDN.

OK I’m stupid :slight_smile:
Clipboard access is only on 4.0 (so only preview :))

4.0 will be released tomorrow :slight_smile:


thanks a lot!