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. Dismiss Notice

Unity 5 Assetbundle

Discussion in 'Editor & General Support' started by Chuvi, Mar 10, 2015.

  1. Chuvi

    Chuvi

    Joined:
    Jul 14, 2013
    Posts:
    14
    I behold a Problem.
    I did assetbundle which added 3 scenes, upload it to your server. After successfully downloaded it using this method
    wwwMain = WWW.LoadFromCacheOrDownload (downloadURL, version);
    Next, try to load the first scene of the loaded assetbundle, everything works fine, but when I try to load the next scene from the same assetbundle, I get an error
    "Level 'Main' (-1) could not be loaded because it has not been added to the build settings.",
    although in the manifest file that scene is registered.

    Then I tried to bring in the log how many scenes uploaded after assetbundle downloaded and initialized using
    Debug.Log ("level count" + Application.levelCount) ;, result: 1.
    I downloaded the demo http://files.unity3d.com/vincent/assetbundle-demo/users_assetbundle-demo.zip and tried to do the same, and it added another scene and build the project, the result same.
    What am I doing wrong?

    Here is an example of the manifest file:
    ManifestFileVersion: 0
    CRC: 617422890
    Hashes:
    AssetFileHash:
    serializedVersion: 2
    Hash: a1b4da19c5eff139167ad6099d3c23af
    TypeTreeHash:
    serializedVersion: 2
    Hash: a54b37c18ce2279be010a258fe3953ca
    HashAppended: 0
    ClassTypes:
    - Class: 1
    Script: {instanceID: 0}
    - Class: 4
    Script: {instanceID: 0}
    - Class: 12
    Script: {instanceID: 0}
    - Class: 15
    Script: {instanceID: 0}
    - Class: 20
    Script: {instanceID: 0}
    - Class: 21
    Script: {instanceID: 0}
    - Class: 23
    Script: {instanceID: 0}
    - Class: 26
    Script: {instanceID: 0}
    - Class: 28
    Script: {instanceID: 0}
    - Class: 33
    Script: {instanceID: 0}
    - Class: 43
    Script: {instanceID: 0}
    - Class: 48
    Script: {instanceID: 0}
    - Class: 49
    Script: {instanceID: 0}
    - Class: 64
    Script: {instanceID: 0}
    - Class: 65
    Script: {instanceID: 0}
    - Class: 74
    Script: {instanceID: 0}
    - Class: 81
    Script: {instanceID: 0}
    - Class: 84
    Script: {instanceID: 0}
    - Class: 90
    Script: {instanceID: 0}
    - Class: 91
    Script: {instanceID: 0}
    - Class: 92
    Script: {instanceID: 0}
    - Class: 95
    Script: {instanceID: 0}
    - Class: 96
    Script: {instanceID: 0}
    - Class: 104
    Script: {instanceID: 0}
    - Class: 108
    Script: {instanceID: 0}
    - Class: 111
    Script: {instanceID: 0}
    - Class: 114
    Script: {instanceID: 0}
    - Class: 114
    Script: {fileID: 11500000, guid: d4e5542169d6adc49be915f668e0bbc5, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 46925de1230b65b4987b06e695777297, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 27692302b162af542bcd56804baa23b0, type: 3}
    - Class: 114
    Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: -1862395651, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: -900027084, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: -113659843, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 949bb662aeec97c49b86d6ef0a25ba89, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: df6d0e53da20c3f4c82bc477c9075d46, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 69a1fc349630453409616d30e9a46499, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 778758f4160ab274795a907a237f48d3, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: cdbb90157d2c3c941b017e54e711c690, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: dec3b5c5887eae042b21859df10e9e40, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 5e9167564155ef643bbce9bb470523fb, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 34e92f86c33b1d245b6823a60c2fb7f9, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 6fd2e8874f60266498a388d7229a1bac, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: f7913ac8912857845916da18db91cf9f, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 65e7e1ba09c227d41a2322dc53d076e4, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 89c0142b641521f4cb5d105514d3f242, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 3ea2f15b045ae7b42a7256b5b15f63c4, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: fcc58d8bc947e2a4392deff938311585, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 315afebb2987c104baa803cba9db903c, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 32a84fdb40e31ff42b8879ce67d928e1, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 147d866c8a3acda4a89ccb9225a361d1, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 141a8fcc1e1585940b63ce7ef9f23d41, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: c226ae0eca9ad6241a2380d9c4794eee, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: e5f9322e03f6e6b4fbe52095fea47451, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 4b9bf46f34472224cb94a521520b6b91, type: 3}
    - Class: 114
    Script: {fileID: 11500000, guid: 336265eff9df7054481b66571a393d45, type: 3}
    - Class: 115
    Script: {instanceID: 0}
    - Class: 124
    Script: {instanceID: 0}
    - Class: 127
    Script: {instanceID: 0}
    - Class: 128
    Script: {instanceID: 0}
    - Class: 137
    Script: {instanceID: 0}
    - Class: 157
    Script: {instanceID: 0}
    - Class: 198
    Script: {instanceID: 0}
    - Class: 199
    Script: {instanceID: 0}
    - Class: 212
    Script: {instanceID: 0}
    - Class: 213
    Script: {instanceID: 0}
    - Class: 222
    Script: {instanceID: 0}
    - Class: 223
    Script: {instanceID: 0}
    - Class: 224
    Script: {instanceID: 0}
    Assets:
    - Assets/Scenes/StartScene.unity
    - Assets/Scenes/Main.unity
    - Assets/Scenes/Match.unity
    Dependencies: []
     
    Last edited: Mar 10, 2015
  2. Chuvi

    Chuvi

    Joined:
    Jul 14, 2013
    Posts:
    14
    Surely no one can help me?
     
  3. relsirc

    relsirc

    Joined:
    Jul 3, 2013
    Posts:
    20
    Maybe you need to add that particular scene to your build settings?
     
  4. Chuvi

    Chuvi

    Joined:
    Jul 14, 2013
    Posts:
    14
    I need my scenes to load from assetbundle. When I do my buld I include only main scene, other scenes must load from assetbundle, and I have them turned on. But when I install my app on device and download asset bundle with the rest of my scenes (
    The unity says that: "Level 'Main' (-1) could not be loaded because it has not been added to the build settings.",
    If I include all my scenes in buildsettings (just build without assetbundle) my build size will be wery heavy.
     
  5. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Create empty scenes, and load all the assets used by those scenes from asset bundles. That way the build process will write the scenes into the exported project.
     
  6. Chuvi

    Chuvi

    Joined:
    Jul 14, 2013
    Posts:
    14
    interesting idea, but it did not work, there is no error, but loaded empty scene
    or do you mean that the empty scene load assets from assetbundle of that description in the manifest?

    no, the manifest no information about assets linked to specific scene
     
    Last edited: Mar 11, 2015
  7. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I mean export all the assets that you have in scene42 out into an asset bundle. Leave scene42 empty, apart from a camera. Then when the scene is loaded, load the asset bundle that contains the objects. Repeat this for every scene.
     
  8. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Hi,

    There is a bug in the AssetBundle building when having multiple scene in the same AssetBundle.
    This has been fixed and will ship in a patch release soon. Not the next patch release but the fix is in the queue.
     
    solkar and Graham-Dunnett like this.
  9. Chuvi

    Chuvi

    Joined:
    Jul 14, 2013
    Posts:
    14
    I thought so, thanks for the help, I will wait for the patch
     
  10. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    Why is it not possible to load scenes that are not in the BuildSettings from an assetbundle? Would make things a lot easier
     
  11. Chuvi

    Chuvi

    Joined:
    Jul 14, 2013
    Posts:
    14
  12. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    That is possible.
     
  13. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    Wasn't the whole thread about that it's not possible ;)
    Any documentation or example how i do that?
     
  14. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Um, no, the thread was about a customer who was having a problem. Steen confirmed it was a bug, and I suggested a solution the customer can use today.
     
  15. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    Sorry i just skimmed through the thread. For some reason i always got an error in the past when i tried to load a scene that's not in the BuildSettings. But now i tried it again and it works