Store thousands of assets

Hi,
I have (dozens of) thousands of assets (images) in my game called regularly via Resources.Load() and this sometimes causes lags. I was wondering if there was a best practice to arrange them better among the files.

For Resources.Load():

  • Is having thousands of images in a single folder a bad idea?
  • Is arranging them among dozens of folders or among long paths of folders an even worse idea?
  • Does it actually change anything at all?

Thanks

Resources.Load often is not the best solution. My personal issue with it is that all files in Resources are always included in builds, even if unused

The best replacement likely is addressables. Here you can manage the data more and I think they also can be loaded async to decrease lag spikes.

Thanks, but if I’m not misunderstanding you, what would be the point of addressables if I don’t intend to remove any assets from my build? Also, all my assets are potentially used in the same scene.

What does deep profiler show about the lag?
and what is your target platform?

1 Like