Launch works / Build doesn't

https://playcanv.as/p/0lWLqdtm/ is the default build of a project I hadn’t changed in a while. That version was built in Nov. 2019.

I made a few changes, which work when I launch from the editor. But when I publish a build, I get a blank screen and various errors in the javascript console. That build is at:

I’ve tried rebuilding a few times and tried in various browsers.

I could list the errors, but they are all visible in the JS console if you look.

I’m happy to try and track down what’s going JS-wise. But since launching from the editor works, I’m guessing it’s a build problem, and not my code.

Any ideas on how to get to a successful build?

Many thanks,

Sebastian.

Hmm… strange that it works in the Editor as looking at the source, it shouldn’t :thinking: Do you not get errors in the Editor launch tab?

In your videotexture.js you only pass in the options:

            this.texture = new pc.Texture({
                format: pc.gfx.PIXELFORMAT_R5_G6_B5,
                autoMipmap: false
            }); 

Whereas the API notes that the first parameter should be the graphics device: https://developer.playcanvas.com/en/api/pc.Texture.html#Texture

// Create a 8x8x24-bit texture
var texture = new pc.Texture(graphicsDevice, {
    width: 8,
    height: 8,
    format: pc.PIXELFORMAT_R8_G8_B8
});

Thanks. Updating to pass this.pc.graphicsDevice worked.

-Sebastian

p…s Editor launch tab was showing error (that I didn’t happen to notice) but basic mechanics still worked. The build just gave a blank screen. I’m assuming that’s a result of the error catching in the editor. But either way, all good now. Thanks again!

The launch build loads each script individually, the build concatenates the scripts together in a single file. This means that an error can stop the whole from working.