Hello! I’m using Babylon Core and GUI version 4.2.0
Problem:
My scene has a bunch of meshes with action managers to handle OnPickTrigger
and OnPointerOverTrigger
. Everything works great if I use the babylon min file from the dist folder on GitHub or the CDN but they stop working if i use my own bundle. @sebavan I think there must be some import that I’m missing.
What I am doing:
I create my own bundle because of file size constrains; to do so, I have a js file that imports the required modules from node_modules
and then use rollup to create the final min.js file.
rollup exports everything as an iife
under the name BABYLON
. Later own I call BABYLON.Engine
, BABYLON.Scene
there are no console errors and everything works as expected except that the events are never raised, meshes for example do not respond to pointer events, nor show the mouse cursor as a pointer. I am unable to reproduce this in the playground because the files are already loaded.
Example:
package.json
"dependencies": {
"@babylonjs/core": "4.2.0",
"@babylonjs/gui": "4.2.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "7.0.0",
"rollup": "1.16.2",
"rollup-plugin-terser": "^7.0.2"
}
index.js
import '@babylonjs/core/Materials/Textures/rawTexture';
import '@babylonjs/core/Materials/Textures/dynamicTexture';
import '@babylonjs/core/Shaders/layer.vertex.js';
import '@babylonjs/core/Shaders/layer.fragment.js';
import {ActionManager} from '@babylonjs/core/Actions/actionManager';
import {ExecuteCodeAction} from '@babylonjs/core/Actions/directActions';
import {Animation} from '@babylonjs/core/Animations/animation';
import {ArcRotateCamera} from '@babylonjs/core/Cameras/arcRotateCamera';
import {Engine} from '@babylonjs/core/Engines/engine';
import {Effect} from '@babylonjs/core/Materials/effect';
import {Material} from '@babylonjs/core/Materials/material';
...
import {VertexBuffer} from '@babylonjs/core/Meshes/buffer';
import {Mesh} from '@babylonjs/core/Meshes/mesh';
...
import {Scene} from '@babylonjs/core/scene';
import {AdvancedDynamicTexture, Button, Control, Line, Rectangle, Slider, TextBlock} from '@babylonjs/gui/2D';
const GUI = {
AdvancedDynamicTexture,
Button,
Control,
Rectangle,
Slider,
TextBlock,
Line
};
export {
Engine,
Scene,
ArcRotateCamera,
...
ActionManager,
...
Animation,
ExecuteCodeAction,
VertexBuffer,
GUI
};