I've recently read this guide published on the Unity website about resources. From the outset, it is clear that he is discouraged from using
Resources unless you prototyping something.
My game is like a 2D role-playing game, and it has more than five thousand monster sprites (yes, a lot). As far as I'm concerned, it makes perfect sense to put all the sprites in the Resources folder, and load only the ones I need (using their name) when a battle starts, and then unload them.
The Unity article highlights one point that can support my approach:
Usually required throughout the project
Well, I'm not so sure – in a single game session, it's quite possible that thousands of these sprites are not used at all, because the player simply does not meet these monsters .
The article goes on to explain why is it discouraged to use
This operation is uncompressable and occurs at the start of the application.
while the non-interactive initial boot screen is displayed.
Initialization of a resource system containing 10,000 assets has been
observed consume several seconds on low-end mobile devices even
although most objects in resource folders are rarely
actually need to load in the first scene of an application.
And it's true, my game takes indeed several seconds to load on some low-end devices, including Android. And it's also true that none of my sprites need to be loaded at startup.
So, I'm ready to stop using Resources – but I'm clueless now: the article does not mention a reasonable alternative to this.
Here are the (unreasonable) approaches that I thought:
Create a component with a collection of all sprites. Thus, they will all be loaded without using resources.
Yes, but I have five thousand sprites. This seems extremely tedious.
Same as the previous suggestion, but use Texture Packer or something similar to condition many sprites in different sheets. In this way, I have to do less work.
My sprites are great and their packaging will not be of much help – I would still end up with a thousand leaves.
My point is that I can not have more than 5000 sprites preloaded. I need to load them at runtime via
Resourcesbut the Unit discourages him clearly. Is there a solution to this?