I have this error showing when creating a new UniversalCamera:
_this.inputs.addGamepad is not a function.
And indeed there is no addGamepad function if I go to the files
I had no issue with classic babylonjs packages.
I have this error showing when creating a new UniversalCamera:
_this.inputs.addGamepad is not a function.
And indeed there is no addGamepad function if I go to the files
I had no issue with classic babylonjs packages.
Yep this is because of the TreeShacking. You need to import the Gamepad module
Ok so I have to make sure myself that all the modules needed are loaded. Understood!
But I wonder why UniversalCamera doesn’t load the Gamepad module then if it needs it?
Something linked to the backward compatibility as you mentionned in the documentation?
Nope this is actually a problem
Pinging @sebavan
In the meantime, you have the list of components here:
https://doc.babylonjs.com/features/es6_support#faq
I imported the gamepad module but it doesn’t change anything.
import { Gamepad } from '@babylonjs/core/Gamepads/gamepad'
Here is an online repo: Hardwino Explanation
Yep I found the issue
will be on the next nightly (in a hour or so)
Thanks, I will test it tomorrow and keep you in touch.
Hi @Deltakosh, how do I test the nightly update?
I realized i could simply use a freeCamera instead of the Universal. But then I have another similar error showing when I create new DefaultRenderingPipeline:
this._scene.enableDepthRenderer is not a function
And I can’t find that function in the babylonjs code in order to import it.
I found it here and now it works: Babylon.js/depthRendererSceneComponent.ts at master · BabylonJS/Babylon.js · GitHub
Verdict on treeshaking: I went from a little more than 3MB to a little less than 2MB! Awesome!
this is gooood!
It seems that there is also a missing import with shadowGenerator:
“shadowGenerator.ts:719 Uncaught ShadowGeneratorSceneComponent needs to be imported before as it contains a side-effect required by your code.”
I made it myself for now.
@PichouPichou how did you resolve this? I’m getting the same issue.
Are you referring to the shadow generator error? Make sure the needed classes are imported.
@RaananW I worked it out thanks. See related topic Production build error "ShadowGeneratorSceneComponent needs to be imported"
You will find all the imports needed using ecma script here: ES6 - Babylon.js Documentation