Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

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:
    85
    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,494
    You can call Object.Destroy on these assets.
     
unityunity