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

How to reduce the memory and clean all references to an asset ?

Discussion in 'Editor & General Support' started by diane1804, Aug 21, 2018.

  1. diane1804

    diane1804

    Joined:
    May 11, 2016
    Posts:
    3
    Hello,

    I'm working on a game with a lot of assets and sprites (for a mobile target, iOs), on Unity 2017.3.1p2.
    I am trying to reduce the texture memory allocated.

    In this game when we enter a building, the inside is dynamically loaded and I want to remove the inside and free the memory when we exit.

    To load, I have a string with the name of the inside prefab. I load the prefab from the Resources folder.
    There is a pnj inside, working with Spine.

    To unload, I destroy the prefab and call
    Resources.UnloadUnusedAssets();
    System.GC.Collect();

    But in the profiler I can see that the material of the pnj is still there and it has a lot of unrelated references. The references seems to loop so I can't find the source.

    I have this problem of material references on all the characters working with Spine.

    Is there a solution to clean all the references of an object ? Or to find where the material is linked ?

    I tried to change the texture quality in quality settings of my project to reduce the texture memory. But the weight of the textures (in the profiler) doesn't change, why ?
    And Unity doesn't try to repack graphic elements in atlases when we change the texture quality ?

    Thanks for your help, if you have other tips don't hesitate !
     
    Last edited: Aug 21, 2018