Bamboozled...stumped...project works in playground only, not locally

Hi there, in my recent post the functionality of changing the green sphere to blue worked. However, returning to my local version, after a 2-hour break, this functionality stopped working for some reason. No problem…I’ll just download the working version from the playground. I did so, but it did not work locally. I even tried uploading the working version to see if the project must be online to work…it didn’t. I am stumped, bamboozled!

I was nearing the end of this project… it feels miles away now. I hope someone can help me.

I am away back to try and figure it out myself, if I can.


This version makes the blues -
(but seems it works only if you pick gizmo first)

Hi labris, thanks for your response. :smile:

Yes, you do have to select the gizmo to change the sphere to blue. I know, ideally the gizmo should appear when the sphere is created. But it is just my inexperience with programming that is to blame for the need to click again. (I do need the gizmo).


In your local project, are you using the same Babylon version than the Playground? Also, do you have errors in the console of the browser?

Hi again Evgeni_Popov, yes, the local and Playground versions are the same. In my local version, I don’t seem to have any errors while trying the 3 steps to turn the sphere blue.

Strange thing now is that I can’t get the Playground version to go blue again…Iabris managed it okay earlier.

Have you tried the Playground version locally yourself?

I’m appreciating your help…thanks.

Ok, so it does not work in the Playground neither, but you need to clean the cache of the browser to see it (CTRL+F5).

That’s because of this change.

@Deltakosh Did you meant to do a breaking change here, as the default value was true for doNotInstantiate before the change?

@Bov You can fix the problem by setting doNotInstantiate = true explicitely when calling instantiateModelsToScene:

Not gonna lie clicked on this just cause of the title, bamboozled ahaha.

1 Like

Actually I want it to be false by default . It was a bug before

Fabulous Evgeni_Popov…thank you very much. I would never have worked that out.

Regarding my earlier post (post link at the top), if you have the time, could you possibly give me just a hint of how to keep track of selected/created meshes in an array, for the purpose of disposal. Just something to get me started, so that I can work on it. No problem if you can’t.


And thanks again to Iabris.

You could have a global array const selectedMeshes = []; declared at top, and in your function that handles mesh selection do selectedMeshes.push(mesh) where mesh is the selected mesh.

Then, to dispose of the meshes:

selectedMeshes.forEach((m) => m.dispose());
selectedMeshes.length = 0;

Note that if you handle mesh unselection, you should do:

selectedMeshes.splice(selectedMeshes.indexOf(mesh), 1);

where mesh is the mesh that has been unselected.

Thanks Evgeni_Popov, that’s very helpful of you…I’ll give it a go.
Cheers :smile:


Hi Evgeni_Popov, just to say thanks again for the code you supplied.

Unfortunately, with me being new to Babylon.js (and JavaScript), I just couldn’t understand them. And that was after many hours scratching my head, Googling, and searching the forum (no your fault).

I have a new post asking if someone could kindly help with this, just to get it finished. If you are interested the post is here.

Cheers, and thanks again for the help you have given me.