Scene or Asset Loading Progress

Hi Everyone!

We’re working on a project with several potentially very large scenes. Creator seems to do a good job of deferring loading those assets to when the scene is loaded. However, I can’t seem to find anyway to track the assets being loaded, or any sort of progress towards the total load.

Essentially, I’m looking for the best way to load a large scene and it’s accompanying assets while being able to show a meaningful load progress bar.

Any thoughts would be welcome, thank you for your time!

2 Likes

Hi,

I have same issue, and can’t find the way to show the exact progress.
Here is my workaround for this issue:

1. Use cc.director.preloadScene to preload large Scene.
like below:

preloadScene: function () {
  this.loadingNode.active = true;

  cc.director.preloadScene("SampleScene", (err) => {
    if (err) {
      // error handling
      return;
    }
    cc.director.loadScene('SampleScene');
  });
},

2. Show progress until the scene loading is completed.
Unfortunately, the progress is not exact, but it will be at least a guide.
like below:

cc.loader.onProgress = (completedCount, totalCount, item) => {
  if (this.progressLabel) {
    var percent = 0;
    if (totalCount > 0) {
      percent = 100 * completedCount / totalCount;
    }
    this.progressLabel.string = Math.round(percent) + '%';
  }
};

I hope that this will be helpful for you.

4 Likes

Wow, thank you so much! This should be more than enough for what I need!

2 Likes

Yup, this solution is perfect, tk so much!!!

1 Like