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.

Get Asset From AssetBundle name

Discussion in 'Asset Bundles' started by LukeDawn, Jul 15, 2021.

  1. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    398
    Hi,

    How do I get an asset with a given assetbundle name?

    I can get a list of all assetbundle names using AssetDatabase.GetAllAssetBundleNames(), but can't find a method to get the actual asset with that bundle name.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,425
  3. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    398
    Thanks @Aurimas-Cernius , butI don't think that's quite what I need. This is editor code, so no loaded assetbundles.

    What I want to do, pre-build, is change the name of the assetbundle, which I can set with AssetImporter.assetBundleName, for which I need to get the asset that has a given assetbundlename.
     
  4. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    372