I resources.load about 500 objects at the beginning of my game. Each is about 8kb, and each comes with an image about 200kb. Profiling, the total amounts to about 100mb ram usage, my entire game about 200mb total ram usage.
My android phone has 1GB ram, nothing else running to hog memory. The game works fine if I Resources.Load a smaller number of objects (tested with 50), but if I try to load all of them at start the build crashes after launch. It loads all of them fine on PC, just not on Android.
Is there some sort of secret ram usage limit I don't know about?
I know I could just not load all resources at once, loading and unloading as needed, but I intended to use all objects simultaneously in game (eventually). I just need to know if this should be possible before I start investing time in alternatives. If so, why isn't it working? And how do I fix it from crashing?
**EDIT:** I'm not even resource.loading the images, only the prefabs that reference them, so I doubt they're the issue. I compressed them recently to be sure, from ~200kb each to ~50kb each. Didn't make a difference. Next I could test loading the objects without any components at all, and see if it's a component or just loading the gameobjects (already pretty sure it's the latter).
There's something about Resources.loading 500 (lightweight objects) on mobile that causes the app to minimize on Android devices while loading. Tabbing back to the app just loads and minimizes again. The unity profiler says the game uses ~200mb of ram, barely any rendering, and like not even 2% cpu usage. Everything else is nothing. Which makes sense.
Idk if this is a performance issue or not, it only happens when I load a lot of these objects, but the end performance hit is still so small idk why it would crash from it. The only performance hit that isn't super light is ram usage, but 200mb on a 1GB phone, idk what the problem is.. I'm so confused. :(
↧