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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

AssetBundles and mainAsset null - v5

Discussion in 'Editor & General Support' started by andyz, Jan 13, 2016.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,140
    AssetBundles changed with 5 but there appears to be no explanation of the mainAsset changes - this variable has no concept in v5 I have read (correct?) yet no warning is given that it will now be null in a v5 asset bundle, nor can you tell if the asset bundle was built with 5 or prior on loading.

    I would suggest a depreciated warning for using AssetBundle.mainAsset if it really is irrelevant in v5 bundles. Though personally I would prefer if it just pointed to the first asset in any bundle...
     
  2. jakovd

    jakovd

    Joined:
    Mar 9, 2010
    Posts:
    15
    I agree. andyz post here is the only information we have on mainAsset and new build API.
     
  3. doggan

    doggan

    Joined:
    Aug 12, 2012
    Posts:
    23
    In 5.3.3, I'm noticing an exception being through by even getting the mainAsset.. not even trying to access it: Debug.Log(asset_bundle.mainAsset);

    I started using something like: asset_bundle.LoadAllAssets()[0], but not sure if this is the correct way to go.

    There's no documentation on this seemingly breaking change (or at least I can't seem to find it anywhere). Wish we had some more info on this.
     
  4. Deleted User

    Deleted User

    Guest

    Sorry for the trouble, we added obsolete warning messages to the old asset bundle build APIs, but apparently we missed this property. Will take care of this.