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

Hi there. Not the same error but I receive this with another bunch of errors when I do an app.destroy. Is another bug or is an error of mine?

@PolVegaTPM Is there a simple reproducible project we can look at please?

@PolVegaTPM Can you try the workaround mentioned here where app.destroy() is wrapped in setTimeout please? https://github.com/playcanvas/engine/issues/3228

1 Like

Hi! I tried to call the app.destroy() inside the setTimeout function but is still giving me tons of errors. Same data is null error.

Hmm… Is there a simple reproducible project we can look at please?

Reproduced above issue in a simple project: https://playcanvas.com/editor/scene/1175882

This being fixed as part of this PR: App destroy with a project using Anim Component causes error messages · Issue #3232 · playcanvas/engine · GitHub

1 Like