Weird PG Compilation Bug

I have noticed something happening with some PGs where they will compile just fine when you are working on them and hitting play; but is someone navigates to it you will see the redbox with ‘createScene function must return a scene.’

as in this scene for example:
https://playground.babylonjs.com/#2M8034

It was also happening to me on a couple of my PG’s. I noticed a work around was to copy all of the code make a new PG then paste the code and hit run, but that’s what made me realize it must be a bug if its happening or more PGs than just mine.

Woot…Yeah this is certainly a bug…Let me check

Well not a bug(well not in the PG;))
check the error console of the PG ( you are using this.scene instead of scene)

Ohh I see where his error is, damn yeah I missed the this.canvas.

I bet it’s similar then to what was happening to me. I just saw the white screen and assumed it was related.

Let me see if I can recreate mine. It was happening when I had some long class definitions above the var createScene = function() {

Ok you are correct its not a bug.

After digging through scene with similar things going on, it was all kinda the same stuff. Wrong references to scene, that actually compile if its inside the createScene function due to scope.

^_^, Awesome don’t know how I missed that.

1 Like