Hi, I think i found a bug.
How to reproduce. Please implement it on localhost for versions:
4.0.3
4.1.0-beta.20
-
Create UI
var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("myUI");
-
Create a button
var button = null; button = BABYLON.GUI.Button.CreateSimpleButton("but", "Click Me"); button.width = 0.2; button.height = "40px"; button.color = "white"; button.background = "green"; button.left = 200; button.top = 200; button.onPointerUpObservable.add(function() { alert("click on button working"); }); advancedTexture.addControl(button);
Test: The Button will work as expected.
The bug.
3. Add simple text after "advancedTexture.addControl(button); "
var text = null;
text = new BABYLON.GUI.TextBlock();
text.text = "Hello world";
text.color = "white";
text.fontSize = 24;
text.left = -200;
text.top = -200;
advancedTexture.addControl(text);
Now try to click the button, it will no longer work.
Testes with the stable version 4.0.3
And also tested with this beta version
“babylonjs”: “^4.1.0-beta.20”,
“babylonjs-gui”: “^4.1.0-beta.20”,
“babylonjs-materials”: “^4.1.0-beta.20”,
I have the code example in playground but the code runs fine on playground but not on local development.
https://www.babylonjs-playground.com/#AUXCUE
The bug is with NPM package 4.0.3 and 4.1.0-beta.20 of course on the localhost.
The curious thing is that if you switch the order, I mean, first add the text and second the button, everything works fine.