Search Unity

Isn't AssetBundle.LoadAsset meaningless?

Discussion in 'Editor & General Support' started by ErayT, Jun 4, 2018.

  1. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    Guys,

    Because we already load asset bundles individually, why do we have to give the asset name to load the asset from the bundle?

    Loading asset bundle:
    Code (CSharp):
    1. var bundle = AssetBundle.LoadFromFile("Assets/AssetBundles/shapes/plane");
    Loading asset from asset bundle:
    Code (CSharp):
    1. bundle.LoadAsset("plane") as GameObject
    There is no sub assetbundle or can be? If so how?

    IMPORTANT EDIT:

    Ok I know understand the assetbundle structure. It was a bit unclear for me. Now I understand that I am able to add more than one asset inside asset bundles.
     
    Last edited: Jun 4, 2018
  2. Madgvox

    Madgvox

    Joined:
    Apr 13, 2014
    Posts:
    1,317
    I'm not sure what you mean. LoadFromFile and LoadAsset perform entirely different functions. LoadFromFile loads an assetbundle, and LoadAsset loads an asset from an AssetBundle. AssetBundles can have more than one asset in them.
     
  3. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    I see... There is a misunderstanding then. So how do you store more than one asset inside asset bundle?
     
  4. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    Ok I know understand the assetbundle structure. It was a bit unclear for me. Now I understand that I am able to add more than one asset inside asset bundles.