Bar showing resource load percentage

Is it possible to add a loading bar that shows the percentage remaining for all resources to load and the first scene of the game to be displayed?

1 Like

Good morning, does anyone know if this can be done with cocos creator?

@pacear10 Isn’t that the default behavior of the loading screen loading the first scene?
If you want to customize it you can create your own custom build template
Custom Project Build Template · Cocos Creator

You can also load any resource or scene with
Asset Loading · Cocos Creator

Through asset loading you also get a values of: loaded resources / total resources = % progress

good afternoon,

Thanks for the answer, if it is the appropriate behavior, maybe I did not explain it well, once the first screen created is loaded, when clicking the play button, it loads a new scene, as it has so many resources, it takes a long time to load I would like to put a loading bar with the percentage of resources loaded in that part.

You can see an example in this link:

When you click the “Play” button, it takes too long to get to the next scene.

You can preload the scene, but you can also load the scene on command. Everything happens though the asset loading, which gives you progress information like mentioned in my previous comment :+1:

When you call loadScene you can pass ‘onProgress’ and ‘onCompleted’ functions
onProgress gives you finished and total. I believe you can do something like this:

private loadScene(): void {
    cc.assetManager.main.loadScene('scene', this.onProgress.bind(this), this.onCompleted.bind(this));
}

private onProgress(finished: number, total: number, item: cc.AssetManager.RequestItem) {
    console.log(`loading progress -> ${(finished/total)*100}%`);
}

private onCompleted(err: Error, scene: cc.SceneAsset){
    console.log(`finished loading the scene`);
}
2 Likes

Good morning, thank you very much that solution is perfect. I can now show a bar with the percentage of load of the resources, when starting a new level

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.