Performance issues with assertManager

Hello guys, i’m having trouble importing assets in my navigator.
I’ve created a 3d card game with 42 cards (each card is a gltf.file 1.6Mo), here is the code

It works once in 10. (when i’m importing only 4 cards it’s perfectly runs).
Would you have some advices to optimize the performance and the loading time?

Could you Look at X variable - all right with this?
Every 4 iteration you need load already loaded card?

No it’s a different card each time, X variable is here to position my cards in the playground

but you use x for generate file name, its ok? every 4 iteration same file name

why to put assetsManager.onFinish..... inside your loop?

1 Like

actually, it’s only changing the task name so i don’t think here is the problem

i don’t know, I thought that was the way to do it, I put it outside the loop but it’s not really changing that much.

yes, you right about task name.
I think @Dshah_H is right - load starts running all tasks and you add over 120 observers, where need only 3. Just need move observers from loop?

I did, it’s looks like it’s working better, but it’s still struggling to load 4 pages.
Here is a capture of the memory, the page size is 250Mo. How could I shorten the loading time?

@Arthur_Boulli, why card gltf has that heavy weight? Perhaps heavy geometry or not needed elements?
I think for card will need one mesh, that you can clone and 42+1 texture (simbols and reverse side). And one texture is a half of image, UV can solve it.

In web we must think about content size, as example not load all textures before game. Perhaps will usefull lazy loading, prefetching, .webp, .gzip and etc) for resources. 1.5 Mb is too many just for card model.

Probably gameplay based on card models and model need be heavy-weight? If not - you can optimize content.

1 Like