Long scene load time caused by many textures in project(mobile)

OK, I’ve been putting this off for a while, but I’d like to figure it out…

I have a 2D game which uses sprites w/ Alpha for all the characters in the scene, which may be quite a few at once and of numerous different types. My pictures folder currently contains about 1,500 images, and I’m about halfway done…

This all runs perfectly fine on a variety of android devices (barring only the CRAPPIEST knockoff I have, which can’t handle the transparency as usual).

That is, everything seems to run fine, once a scene is loaded, however, EVERY TIME I load a new scene (really it’s just back and forth between two scenes), it takes like 20 or 30 seconds.

This is due to the large number of textures. Every time I add another stack to the project, the load time increases. To be clear, I would expect, say, an increased game load time at LAUNCH, when all the textures are first cached. I MIGHT EVEN anticipate a long load in general for my MAIN scene, which actually may involve the sprites in question… But even loading my menu scene takes super long now, and that does not involve any sprites… And, like I said, once my main scene (or any scene) is loaded, there is no performance issue, even though ANY of my prefabs may be instantiated at any time… (meaning all the textures are successfully cached with no apparent lag) So why does changing scenes always take so long?

A bit more on the setup:
Each “character” is a game object with a script which contains several Texture arrays, which are already set with their appropriate textures… These are all prefabs, and are instantiated/destroyed randomly as needed in my main scene, without issue.

Note that, since all my levels are in fact one single scene, I could simply combine it with my menu scene to make the whole game essentially one scene… That would (essentially) solve this issue, but I’d like to understand the real deal… Why is it that more PICTURES in my ASSETS folder equals longer load for EVERY SCENE, EVERY TIME? And, is there a way around this?

(my suspicion is that the resources are maybe being automatically re-loaded (onto the prefabs?), in which case I’m thinking maybe I need to put everything into the Resources folder to avoid this… Or maybe just dynamically create my character templates in-scene so there are no prefabs… But I may be way off… I am about to start a test build to test these (A: is it the prefab connection, or the textures themselves… and B: will Resources provide a solution, or the no-prefab approach, etc), but meanwhile any advice is greatly appreciated!)

I’m a bit confused. You said your game happens only in one scene, so why do you switch the scenes all the time? I think the problem is that you don’t reference any of the prefabs / assets in your menu scene. Unity loads on demand so when you load your game scene it will load all prefabs + images into memory. When you switch back to then menu scene the prefabs are no longer needed since there’s no reference to them anymore. I guess that unity will unload the assets when you enter the menu scene. That’s what takes so long when you switch back to the menu.

It’s hard for unity to determine what assets you might want to use again and which ones can be removed. Since the scene and all references to the assets have need destroyed I guess unity will remove the assets.

If that’s the problem you can try to add a manager script that hold references to all your prefabs and use DontDestroyOnLoad on it. Keep in mind that loading a scene again will duplicate objects which have been marked with DDOL. So it’s best to create the manager object by code and check if it exists already (a classical singleton)