Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity UI Sprite Atlas not being unloaded because of infinity reference loop

Discussion in 'UGUI & TextMesh Pro' started by nat-soragge, Jul 16, 2018.

  1. nat-soragge

    nat-soragge

    Joined:
    May 15, 2013
    Posts:
    8
    Hi! I am having a problem with UnloadUnusedAssets and Sprite Atlas assets.

    I have an app where panels are loaded from Resources and stacked. For each panel, I have an atlas with UI elements. The panels are destroyed once they're closed, and I call UnloadUnusedAssets to avoid memory issues. I know this is costly, but it's working fine for me. No perceptible spikes or anything. The problem is that the atlas of the panel is never being unloaded. Looks like there's an infinity reference loop preventing them to be unloaded, as you can see in the memory profile:

    upload_2018-7-16_0-10-35.png

    The atlas references all its sprites and every sprite has a reference to the atlas. And the only reference they have is between themselves, nothing external. Is this normal? What's the best way to unload all of this? Will I have to track exactly what atlases each panel uses to force their unload individually?

    Thanks in advance.
     
  2. Chocolate-Pi

    Chocolate-Pi

    Joined:
    Oct 17, 2015
    Posts:
    8
    Bump; I also seem to be experiencing this.