Search Unity

[SOLVED] LoadAssetAsync never be completed for external storage of Oculus GO

Discussion in 'Scripting' started by Kagyu, Jun 29, 2018.

  1. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    96
    Hello,

    I am trying to load an asset from the local storage of my Oculus GO.
    I made an asset bundle and placed it to Oculus GO's local storage.
    I built and ran the application and watched the log in the VR scene then I found that asset bundle was loaded but the asset was not loaded from the asset bundle. I gave my app external storage access permissions of course.
    When I use Application.streamingAssetPath, then my app works without any issue but I like to use external storage because I want players to add their own contents.
    Does anyone have any idea or advice how I can fix this issue?
    FYI, below is the code I wrote.

    Code (CSharp):
    1.         bundleUrl = "file:///sdcard/" + assetName;
    2.         AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(bundleUrl);
    3.  
    4.         yield return new WaitWhile(() => request.isDone == false);
    5.  
    6.         if (request == null)
    7.         {
    8.             Debug.Log("Request is null");
    9.             assetText.text = "Asset Bundle not Loaded";
    10.         } else
    11.         {
    12.             Debug.Log("Asset Bundle Loaded");
    13.             assetText.text = "Asset Bundle Loaded";
    14.         }
    15.  
    16.         AssetBundle assetBundle = request.assetBundle;
    17.         AssetBundleRequest actor = assetBundle.LoadAssetAsync<GameObject>(assetName);
    18.  
    19.         yield return new WaitWhile (() => actor.isDone == false) ;
    20.  
    21.         if (actor == null)
    22.         {
    23.             assetText.text = "asset is null";
    24.             if (System.IO.File.Exists(bundleUrl) == false)
    25.             {
    26.                 assetText.text = "Cannot access the File";
    27.             }
    28.  
    [Edit] After messing around a little more, I found that below method works.
    Code (CSharp):
    1.         UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(string path);
    2.  
     
    Last edited: Jun 29, 2018
    P_Jong likes this.
  2. wikieden

    wikieden

    Joined:
    Oct 16, 2016
    Posts:
    4
    I can load the asset but the lightmap is missing when single pass, multi-pass is fine.
    unity 2017.4.5f1
     
  3. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    96
    Your asset bundle is not in the StreamingAssets folder, right?
    Could you tell me where you located your asset bundle and how you load it, please?