Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resources.UnloadUnusedAssets crash

Discussion in 'iOS and tvOS' started by PeaceToFar, Sep 23, 2013.

  1. PeaceToFar

    PeaceToFar

    Joined:
    Jul 9, 2013
    Posts:
    19
    When I call Resources.UnloadUnusedAssets, it crashed because GC.Collect() take much cpu. How to solve it?
     
  2. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Could you please post more details how you are getting this?
    Which device you are testing on?
    Are you launching app via Xcode?
    Do you see any error messages in device console / Xcode debugger console?
     
  3. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    131
    :( when i call this after loading some assetbundle, crash in Unity5.1.0f1
     
  4. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Please submit a bugreport.
    Thanks!
     
  5. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    We just end up having the exact same behaviour that we noticed last week. It happens only on a build, only on PC, but the worst part is that we have absolutely no call stack.

    We added Debug.Log info before and after that call (UnloadUnusedAssets) and the log after is never called.

    Since we are switching scenes, Unity call it as well, so we thought it might be because we called it twice, but even if we comment that line, the one Unity call internally crash the same way.

    I don't see what kind of BugReport I could submit since there is no callstack at all.

    Any ideas?
     
  6. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    We might have found the solution to that specific crash.

    In some cases we had multiple static List<GameObject> in different classes to optimize performance when searching through some gameObjects.

    However, it seems that Unity has a major problem when unloading those list at the end of a scene and it seems directly related to our crash.

    Those list were not cleared before calling UnloadUnusedassets. We now manually call .Clear on those static list and in some cases we removed the Static identifier.

    That is still very frustrating that no call stack were printed to help us find the problem.

    P.-S. I reported a bug that I cannot link right now, since it points towards other private bug report even if the latter should be public. Also, I posted the same answer on the AnswerHub.
     
    Last edited: Jul 1, 2015
    x1alphaz1 likes this.