Search Unity

How to load an assetbundle for Android after build?

Discussion in 'Unity Build Automation' started by JonMoon, Oct 20, 2017.

  1. JonMoon

    JonMoon

    Joined:
    Feb 26, 2015
    Posts:
    10
    I want to upload my assetbundles to an external server after a build is done, and to do that I need to get an assetbundle that UnityCloud created for me, but I get a WWW error when trying to load the file. The method is being called as a Post-Export method in UnityCloud
    I've confirmed that the files are actually being created
    The URI that I specify is
    file:///BUILD_PATH/xxxxxxxxxxxxxxxxxx.game_project_name.android-development-branch/unity/Assets/StreamingAssets/Android/Android

    Code (csharp):
    1.  
    2.         var abPath = <the URI specified above>
    3.         var abDownload = WWW.LoadFromCacheOrDownload( abPath, 0 );
    4.         while( !abDownload.isDone )
    5.             ;
    6.         if(abDownload.error != string.Empty ) {
    7.             Debug.LogWarning( abDownload.error );
    8.         }
    The WWW error I receive is Unknown Error

    Is the path I am working with wrong, is there a different way to load the file? I am using Unity 2017.1.1f1
     
  2. JonMoon

    JonMoon

    Joined:
    Feb 26, 2015
    Posts:
    10
    I hate bumping, but I still haven't been able to solve this problem. Is there anyone out there that can help?
     
  3. JonMoon

    JonMoon

    Joined:
    Feb 26, 2015
    Posts:
    10
    I ended up using File.ReadAllBytes to read in the contents of the file instead of WWW