After loading animation from .glb, app.destroy errors

I am loading a .glb file as a container asset, with model and animation data. This works fine, but when I call app.destroy it starts logging a lot of errors :slight_smile:
image
This happens when using engine-only as well as through the editor.
My code for loading GLB:

var LoadGlb = pc.createScript('loadGlb');

LoadGlb.attributes.add("glb", {type: "asset"});

LoadGlb.prototype.initialize = function() {
    var app = this.app;
    
    var blob = new Blob([new Uint8Array(this.glb.resource).buffer]);
    var url = URL.createObjectURL(blob);
    
    this.app.assets.loadFromUrlAndFilename(url, "model.glb", "container", function (err, asset) {
        var entity = new pc.Entity("GLB Model");
        
        entity.addComponent("model", {
          type: "asset",
          asset: asset.resource.model,
        });
        
        entity.addComponent("animation", {
          assets: asset.resource.animations,
            loop: true
        });
        
        app.root.addChild(entity);
        
        setTimeout(function(){
            app.destroy();
        }, 2000);
    });
};

Reproducable project: https://playcanvas.com/project/746692/overview/animation-destroy-app-bug
The glb loader is on the Root object. I’ve also imported an fbx version with mesh and animation, which does not cause the error (thats the disabled object in the hierarchy ‘cube_withanim’.

1 Like

It does look like a bug. @yaustar what do you think?

1 Like

Yeah, looks like it

2 Likes

we have internal ticket on few of these, but without a repro … thanks for providing one, we’ll try to fix it soon (for our reference: monorepo #355)

2 Likes

Is there an update on this? It seems like it’s still broken?

We have someone look at this as soon as possible.

2 Likes

I’ve made a PR for this bug here: https://github.com/playcanvas/engine/pull/2703

1 Like

I believe these were fixed yesterday and should come out with the engine release soonish. But we’ll double check.

1 Like