Search Unity

Android Build and Resources.Load

Discussion in 'Editor & General Support' started by penneyworth1, May 27, 2017.

  1. penneyworth1

    penneyworth1

    Joined:
    Feb 7, 2015
    Posts:
    13
    I am experiencing extremely long load times on Android builds. I can load a highly complex scene with a few thousand game objects (pools of bullets, enemy ships, explosion effects, etc...), and there are no issues. But when I try to load a new scene (an extremely simple scene), there is a wait time of sometimes more than a minute!
    Looking at the logcat, I see that when loading the new scene, this messages is being printed out 1000's of times during the long wait:
    "Unloading 0 Unused Serialized files (Serialized files now loaded: 0)"

    This only happens on android builds, and even on android this never happened until the latest versions of unity and android sdk.

    If I stay in the complex scene for about two minutes, there is no issue, but if I go to the next scene after a short time (player dies after less than a minute), this horrible wait time happens.

    After researching the issue for a few days now, the only people who have run into this problem seem to say that it can be solved by not using Resources.Load. But I need that function to load prefabs in my complex scene. I cannot create references to every possible prefab in the game that could be loaded into the scene, because that would be a terrible waste of memory.

    I'm in desperate need of help. Thanks a million in advance if you see this and have any information.
     
  2. penneyworth1

    penneyworth1

    Joined:
    Feb 7, 2015
    Posts:
    13
    Update:
    I removed all calls to Resources.Load in my complex scene and got all the assets from script references. The problem is exactly the same. 1000's of messages on the logcat saying
    "Unloading 0 Unused Serialized files (Serialized files now loaded: 0)"
    While the next scene loads for over a minute.
     
  3. NataliaJun

    NataliaJun

    Joined:
    Jun 20, 2017
    Posts:
    2
    Hello! We have the same problem in Android. Did you solve the problem?
     
  4. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi,

    Thanks for reporting this!
    It sounds like a bug with Resources.Load, where it implicitly creates additional resource cleanup async operation. That queued 1000 times might introduce significant overhead.

    Could you please file a bug and provide a repro project.

    As a workaround it might be possible to boost async operations execution priority by setting Application.backgroundLoadingPriority = ThreadPriority.High for the load period.
     
  5. NataliaJun

    NataliaJun

    Joined:
    Jun 20, 2017
    Posts:
    2
    We almost don't use Resources.Load. We tried to deactivate all game objects in the scene and deleted all heavy loading scripts, but it didn't help. In Unity 5.6.1 time for load has doubled.