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. Dismiss Notice

LoadAssetAtPath Memory + 2018.1

Discussion in 'Editor & General Support' started by stgs73, Jul 6, 2018.

  1. stgs73

    stgs73

    Joined:
    Mar 23, 2015
    Posts:
    59
    Hi, we're running into an old issue where LoadAssetAtPath is called on a lot of prefabs in our project.
    As the number of prefabs is pretty huge, memory has now become an issue.

    We only need to know some info on the prefab so we can process things later..i.e. find out + extract some info if a component is on it and so on.

    As for clearing up, we've tried all the usual

    EditorUtility.UnloadUnusedAssetsImmediate();
    GC.Collect etc

    The assets are not being held or referenced by anything, is there anyway to purge or release the memory once that LoadAssetAtPath is called? Right now we have to close the editor down and re-open.

    The issue is that on our machines, our boot time into our app drops by about 10x once we've run this process and it will be tricky to avoid this flow..

    Not sure if we're missing anything obvious, we also are not able to jump to 2018.2 to use the new ResourceManager right now..

    thnx
     
  2. Cobo3

    Cobo3

    Joined:
    Jun 16, 2013
    Posts:
    65
    I'm also having the same issue. Calling "Resources.UnloadAsset" print an error saying:

    "UnloadAsset may only be used on individual assets and can not be used on GameObject's / Components or AssetBundles"

    Isn't there any way to remove that asset from memory?
     
  3. qcbf1

    qcbf1

    Joined:
    Nov 1, 2013
    Posts:
    19
  4. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,151
    Bump. I need to know this as well, there must be a way to free the memory. If not, than boo Unity.
     
  5. WANJ

    WANJ

    Joined:
    Dec 4, 2018
    Posts:
    1