[SOLVED] Need to unload a loaded glb-model

PS: so works fine on the model itself, but the attached textures are troubling me still:

LoadExtGlbFullOwnTexture.prototype.unloadModel = function(){
    var app = this.app;
    var self = this;
  
           var meshes = null; 
           meshes = self.entity.model.model.meshInstances; 

                          for(var i=0; i<meshes.length; i++){ 
                              var mesh = meshes[i];
                     
                              console.log( ":: || "+ mesh.node.name + " chg "+i);

                              asset.unload(); //aproach 1: your suggestion but no change [err: on asset > how to assign asset, when external from start; then pushed to assets, for finally to be taken off leaving original texture?]
                              
                              self.entity.model.model.meshInstances[i].material.destroy(0);   //aproach 2: no change
                              self.entity.model.model.meshInstances[i].material.destroy(1);  ///aproach 2: no change
                              
                              self.entity.model.model.meshInstances[i].material.diffuseMap = null; // apporach 3: 'hail mary' ... no change
                              }
    self.entity.removeComponent("model");   
};

Was wondering if I should go in this direction;

  • but as yauStar writes/wrote below the thread seems to be part of a repo debug-issue.
    As such there might be a easier way to handle material/texture resets? (would not dare to use time, examples/solutions that has become impossible to a later repo)