Search Unity

How to uninstall a single asset of AssetBundle.

Discussion in 'Asset Bundles' started by zhuxianzhi, Apr 1, 2021.

  1. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    122
    Code (CSharp):
    1.  
    2. var ab = AssetBundle.LoadFromFile("Ab");
    3. var a = ab.LoadAsset<Texture>("a");
    4. var b = ab.LoadAsset<TextAsset>("b");
    5.  

    Similar to the interface of Resources.UnloadAsset.

    I don't want to unload the AssetBundle, (AssetBundle.Unload(true)), but I want to unload the loaded assets, such as A/B.
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    You can call Object.Destroy on these assets.