Button show/hide for glb files

Any one know why this button dont work for glb files?
If i swich my mesh format to pietro.babylon it is working but pietro.glb work only for “hide” function.

BABYLON.SceneLoader.ImportMesh("", “./”, “pietro.glb”, scene, function (myMeshesTwo) {


var b_pietro = document.createElement(‘buttons’);
b_pietro.id = “pietro”;
b_pietro.textContent = “Pietro”;
b_pietro.onclick = function() {
// Show/Hide myMeshTwo
for (mesh of myMeshesTwo)
mesh.setEnabled((mesh.isEnabled() ? false : true));

Can you share a repro somewhere? maybe on the playground if possible?

Here is my scene im working on. All thre meshes are glb files that i cant unhide:

You are using different versions for the loader and the engine

They should all come either from cdn or from preview but not a mix

Made some changes but still no luck.

As @Deltakosh already said a repro in the playground will be most appreciated as it is really hard to debug without it ?

At a first glance it looks like you are enabling from children to parent which might be the issue, the repro would help quite a lot

Here is my scene in playground:

but not working , no meshes, no buttons

There are a number of issues in your playground which I have corrected here https://www.babylonjs-playground.com/#8V8L47#2

The major one is that you cannot load files from http in the playground you have to deliver from a https server. I have used available glb files from here Available Textures in the Playground - Babylon.js Documentation to test the logic.

Also used a viewable 360 image from the same source.


mesh.setEnabled((mesh.isEnabled() ? false : true));

seems to always sets enabled to false so I have changed the logic.

Also I have removed code that is not needed in a playground from the start and end and tidied up the line spacing to make it more readable for other.

Good luck with your project.

Perfect. Thank you so much.