Babylon-gui on local dev with typescript not working

Hi there, I’m working with a modified typescript starter git from leon

git clone https://github.com/leon/starter-babylonjs

I’ve been adding a few missing elements but I can’t seem to get the GUI to work here on a local dev.
The same goes for some extra materials like the GridMaterial.
When using the GUI.AdvancedDynamicTexture.CreateFullscreenUI(“UI”);
I get the following error:

image

import * as GUI from 'babylonjs-gui';
var pointerElement = GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");

I used the

npm install --save babylonjs-gui

To add in the babylonjs-gui package.
If there’s anything else I need to do/check please let me know!

Thanks

This minimal example definitely works for me - GitHub - eldinor/BabylonTS-NPM-Minimal: Babylon Typescript NPM Support Minimal.
It imports from “babylonjs-gui”.
One may import also from “@babylonjs/gui”.
But need to check so all imports would be either with @ or without it.

1 Like

looks like you have both @babylonjs/… and babylonjs-… which are not compatible together
image

you should either rely on @babylonjs/core and @babylonjs/gui for the es version or babylonjs and babylonjs-gui for the bundled version.

2 Likes

Thank you for the help.

    "@babylonjs/core": "^5.0.0-alpha.65",
    "@babylonjs/inspector": "^5.0.0-alpha.65",
    "@babylonjs/loaders": "^5.0.0-alpha.65",
    "@babylonjs/materials": "^5.0.0-alpha.65",
    "@babylonjs/serializers": "^5.0.0-alpha.65",
    "@babylonjs/viewer": "^5.0.0-alpha.65"

I’ve added these dependencies which did the trick.

2 Likes