# GLTF Loader Loading Manager firing onProgress function twice!

**URL:** <https://discourse.threejs.org/t/gltf-loader-loading-manager-firing-onprogress-function-twice/17399>\
**Category:** Questions\
**Tags:** gltf-loader\
**Created:** [July 25, 2020, 6:38pm UTC](https://discourse.threejs.org/t/gltf-loader-loading-manager-firing-onprogress-function-twice/17399 "2020-07-25T18:38:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kanistra](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kanistra/32/26750_2.png) [@kanistra](https://discourse.threejs.org/u/kanistra)\
**Post date:** [July 25, 2020, 6:38pm UTC](https://discourse.threejs.org/t/gltf-loader-loading-manager-firing-onprogress-function-twice/17399/1 "2020-07-25T18:38:47Z")

</div>

For some reason, in console log, i see onProgress fired twice. I have one GLTF model to load but load manager is treating it like I have two models. if I add another model it will do the same, it will load total 4 models but in reality, it is two.

Here is my console log:

 ![Untitled-1](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/a/a3c1cf22b5d4ba45d0ce085ce8f11e747388b2eb.jpeg)

Here is my code:

let manager = new THREE.LoadingManager();  
manager.onStart = function ( url, itemsLoaded, itemsTotal ) {

```
console.log( 'Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );

```

};

manager.onLoad = function ( ) {

```
console.log( 'Loading complete!');

```

};

manager.onProgress = function ( url, itemsLoaded, itemsTotal ) {

```
console.log( 'Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );

```

};

manager.onError = function ( url ) {

```
console.log( 'There was an error loading ' + url );

```

};

```
this.loader = new GLTFLoader(manager);

this.loader.load(model1, (gltf) => {

  gltf.scene.traverse(function(child) {

    
   

      child.material = mat;   
      let pos = gltf.scene.children[0].children[0].geometry.attributes.position;

           let count = pos.count/3
           let bary = []
           for (let index = 0; index < count; index++) {
            bary.push(0,0,1, 0,1,0, 1,0,0)
           }
            bary = new Float32Array(bary)
           gltf.scene.children[0].children[0].geometry.setAttribute('barycentric', new THREE.BufferAttribute(bary,3))
   
  }
  );
  

  

  this.supamesh = gltf.scene.children[0].children[0]
  this.supamesh.geometry.center();
  this.scene.add(this.supamesh);

  
  

 })
```

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [July 26, 2020, 2:39am UTC](https://discourse.threejs.org/t/gltf-loader-loading-manager-firing-onprogress-function-twice/17399/2 "2020-07-26T02:39:53Z")

</div>

The model may contain embedded resources that get counted toward loading as well — onProgress can be called multiple times per model. If you want to count the number of models that have fully loaded, it would be best to use the onLoad callback for that instead.

---

<div class="post-metadata">

**Author:** ![kanistra](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kanistra/32/26750_2.png) [@kanistra](https://discourse.threejs.org/u/kanistra)\
**Post date:** [August 3, 2020, 8:14pm UTC](https://discourse.threejs.org/t/gltf-loader-loading-manager-firing-onprogress-function-twice/17399/3 "2020-08-03T20:14:29Z")

</div>

Thank you, just wanted to know why it happening.

---

<div class="post-metadata">

**Author:** ![kif11](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kif11/32/5993_2.png) [@kif11](https://discourse.threejs.org/u/kif11)\
**Post date:** [May 30, 2021, 6:42am UTC](https://discourse.threejs.org/t/gltf-loader-loading-manager-firing-onprogress-function-twice/17399/4 "2021-05-30T06:42:29Z")

</div>

Docs say that `.onLoad : This function will be called when all loading is completed.` I also see that behavior in my setup where onLoad called at the very end where all models are loaded.

It seams broken or I misunderstanding something. I can not figure out how to get progress per model URL that I provide to the loader.

GLB files should be loaded as one piece. I don’t quite understand why onProgress is called twice per file.
