Rook Posted September 25, 2017 Share Posted September 25, 2017 I am getting the following error when trying to explore the GUI extension. I think that I might be cross-pollinating between the new modular approach that just came out, and maybe old instructions for pre-alpha docs? From http://doc.babylonjs.com/overviews/gui (I am showing my requires at the top, and line 61 from map.js): var BABYLON = require('babylonjs') var GUI = require('babylonjs-gui') ... var gui = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI('UI') // var gui = GUI.AdvancedDynamicTexture.CreateFullscreenUI('UI') Uncaught TypeError: Cannot read property 'add' of undefined at new r (/home/rook/Documents/Projects/babylon-testing/node_modules/babylonjs-gui/babylon.gui.mi…:1) at Function.r.CreateFullscreenUI (/home/rook/Documents/Projects/babylon-testing/node_modules/babylonjs-gui/babylon.gui.mi…:1) at createScene (map.js:61) at map.js:68 I have tried both using GUI.AdvancedDynamicTexture.CreateFullscreenUI() and BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI() as you can see from the commented-out line. Both error out. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 25, 2017 Share Posted September 25, 2017 Could you make a PG to see this error ? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 26, 2017 Share Posted September 26, 2017 The new docs are up here, but are for imports:http://doc.babylonjs.com/overviews/npm_support Also, and importantly, are you using 3.1.0-alpha3.4 or 3.1.0-alpha3.5 - there are big changes there? Here is a working example (using import not require):https://github.com/brianzinn/create-react-app-typescript-babylonjs/blob/master/babylonjs-site/src/containers/home/index.tsx I have seen the exact error you are getting it was something like xxx.onKeyboardDownHandler.add(...) - ensure you don't have another NPM package referencing an older version of babylonJS as a dependency (or redo your node_modules). GUI won't reference a different version as it has a peerDependency to BabylonJS core. Otherwise, do you have more of the stack trace - hard to see if there is something in your code or in babylonjs. Quote Link to comment Share on other sites More sharing options...
Rook Posted September 26, 2017 Author Share Posted September 26, 2017 There is something funky going on with my local version of 'npm', I think. I was working to show something to Deltakosh on another issue, and when I deleted node_modules and rebuilt with 'npm install', then everything seemed to start working, so I am not sure if dependencies were horked up somehow or not. But the rebuild worked when I tried it again on this issue! I am adding this to my troubleshooting steps, as I've learned that it is not entirely reliable to just 'npm remove' and 'npm install' packages back to back. I was doing this in troubleshooting a prior issue. I am new to Node so forgive this firedrill. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 26, 2017 Share Posted September 26, 2017 Heard that netflix now uses 1/3 of the internet and "rm -rf node_modules && node install" uses the other third (jokingly)... that's why. Yarn (https://yarnpkg.com/en/) has more deterministic installs, so I use that - also works offline. Quote Link to comment Share on other sites More sharing options...
Rook Posted September 26, 2017 Author Share Posted September 26, 2017 I will investigate Yarn, thanks. I have seen it mentioned in several tutorials, just haven't delved into it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.