Extremely slow scene loading with Unity Android

There’s a wired problem for my android game (migrated from my existing iPhone game), the scene loading is too long, almost longer than a minute.

My devices are Galaxy S and Galaxy Tab. Since they have fast CPU GPU than iPhone 4 so I can’t believe this result is normal.

My game loading was fast for iPhone version. On iphone 4 it was about 10s and on 3GS that was 15s.

I thought that could be the problem of the asset so I reduced the size of texture but it does no help. Then it must be some thing wrong with my project settings. Can anyone help me to figure this out?

Any help will be appreciated

Edit

In android task manager, it consumes more than 100m RAM during loading a scene. And then reduced to 30m when the new scene is loaded. The RAM can be the cause, but I can I fix it?

Android is currently expected to have slightly longer loadtimes, but that seems a bit excessive. Are you perhaps relying heavily on Resources.Load() to access your assets? Is the logcat showing anything ‘useful’ / related?

Thanks for the reply.
Yes I have some assets with Resources.Load(). It’s about 4 skinned meshes to be allocate in Start() method when the scene is loaded.
If that was the problem, what’s is the replacement if I want assets loaded at runtime?

There is no replacement as such; I’m more trying to pinpoint if the loadtimes you see is because of using Resources.Load() (which we have plans to optimize) or that you find some other corner case. If you could point those skinned meshes to a (global) dummy asset in the scene, to remove the dependency on Resources.Load() and to see if that drastically changes the loadtimes; then we at least know that the problems you are seeing is because of slow Resources.Load().
And, if possible, open a bug with your project as a repro case would of course be valuable too.

Has this been resolved?
I’m trying to figure out how if this is causing my issues with very long load times (4 minutes for one scene) or if I should be looking for something else. I am trying to trial and error the issue, but 20+ minute build times is making it quite a hassle.

A little more background… we’re going from a fully functional iOS game to Android.

Also, if you don’t know the answer but also experience this issue, let me know. I wouldn’t feel so alone here. :wink:

Hmm I don’t see anything in the 3.2 release notes about Android Resources.Load() being slow I was also wondering if it’s not recommended to use Resources.Load().

– edit –
OK cool- my scenes seem to load very quickly on Android. And that’s even with the PVRTC->RBG decompression going on in the background.

Ah, I’m having the same problem on my project. It works great on iPhone and iPad, but not on Android (testing on Nexus One).

Whenever I switch to a new scene, it takes about 20+ secs to switch to it, while it takes just 1 second on iPhone.

I’m not using Resources.Load much (just on a couple text files), so that shouldn’t be the cause for my problem.

I do however use AssetBundles on all the bigger graphics, so whenever I switch scenes, I go through a “Load” scene which pre-loads the needed AssetBundles and unloads all other AssetBundles, before continuing to the target scene, so I’m suspecting that might have something to do with it…

I haven’t gotten to test it out much yet, as I just started on the Android build today.

Interesting; have a look in the logcat (‘adb logcat’ from cmd.exe / Terminal, or DDMS; both part of the Android SDK) when you trigger that “Load” as there might be some hints to what’s going on.
Also, if you manage to get a small’ish / simple project that reproduces that problem please just report it as a bug (Help → ‘Report a Bug’) and attach said project.

I don’t know if this has anything to do with anything, but if i use async loading for scenes, loading times on iphone takes 30+ extra seconds, and on android i have never waited long enough to see the level finish loading…

Hello,
as explained in this topic : http://forum.unity3d.com/threads/78438-Tip-Faster-animationClips-loading-time
I found a way to dramatically reduce loading times on my Galaxy S, for a game that heavily uses animations (500+ per character).
Hope it helps.

Here’s what logcat says:

D/dalvikvm(  610): GC_EXPLICIT freed 2310 objects / 135248 bytes in 880ms
V/Unity   ( 1198): 
V/Unity   ( 1198): Unloading 7 unused Assets to reduce memory usage. Loaded Objects now: 1340.
V/Unity   ( 1198): Unloading 3 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
V/Unity   ( 1198): 

SWITCHED SCENE HERE

V/Unity   ( 1198): Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 1801.
V/Unity   ( 1198): Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
V/Unity   ( 1198): Non platform assembly: /assets/bin/Data/Managed/System.dll (this message is harmless)
D/dalvikvm( 1198): GC_FOR_MALLOC freed 5980 objects / 402504 bytes in 64ms

I’ve also turned off any AssetBundle loading, and it still happened. I also switched from LoadLevelAsync to LoadLevel but that didn’t help either…

When starting the game, if I go directly to the title scene without going through others, it seems to go faster though, instead of going through the “load” scene (even if the load scene doesn’t do anything but loading the target scene). So might somehow be just the scene switch itself that takes a long of time.

I’ve submitted a bug report with a small project it happens on now though, so hopefully we’ll be able to find out what makes it happen :slight_smile:

Have you happened to gotten any further with this, tr1stan?

I’ve submitted a sample project bug report to Unity a week ago, but haven’t heard anything back yet. Hoping it’s something that will be looked at, as it’s the only thing keeping me from releasing the game on Android :slight_smile:

TMK, may be your report got lost? Please provide a six digit case number (no links please) of your bugreport so I can recheck.
And thank for submitting a bug.

I also experience this issue. I’m not doing Resources.Load() or anything crazy, but my scenes are like 30 seconds or more to load, whereas on iPhone4, they’re like 1 second.

Anyone made any progress on it? I have got to get this fixed before we release!

EDIT: I am doing LoadLevelAsync() on one scene, but the loading of all the scenes is super slow, not just that one.

Thanks for your reply! It would be great if you could check it :slight_smile:

Here’s the bugreport number: Case 392128

Reducing some of my textures to 16-bit made a HUGE difference. I went down from 30 secs to 10.

Ah, thanks for that info, sandworm! That’s very interesting. Unfortunately I’ve set almost all my textures to 16-bit already, so perhaps I already have that speed boost on my project…

No worries :slight_smile: I wish I could get a better 16-bit render from the unity texture converter though, it looks really ugly on some of mine if I do 16-bit.
I’m at GDC in San Francisco now, and I intend to ask the Unity dudes tomorrow a few questions :slight_smile:

Oh, I was about to comment on that too actually. On iOS, 16-bit textures looks very good, depending on the texture it looks very similar to 32bit, but on Android, the same textures looks like they have even less colors, making them more ugly.

That’s hopefully something we can work around though, just have to get that slow-scene loading fixed somehow :slight_smile:

Just an update, I installed the newest Unity 3.3 version now, and the same very slow scene loading happens there unfortunately…