Search Unity

Asset Bundle returns null in andriod

Discussion in 'Asset Bundles' started by optikalsapp1, Aug 8, 2019.

  1. optikalsapp1

    optikalsapp1

    Joined:
    Aug 5, 2019
    Posts:
    1
    I am downloading assetBundle from server using UnityWebRequest and it is working good in unity editor but in andriod it gives null value can someone help

    public IEnumerator DownloadAsset(string url, string assetName)
    {
    using (UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(url))
    {
    yield return www.SendWebRequest();
    AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
    if (bundle != null)
    {
    AGUIMisc.ShowToast("Not Null");
    GameObject temp = bundle.LoadAsset(assetName) as GameObject;
    var newobjj = Instantiate(temp);
    newobjj.transform.parent = maleparent.transform;
    }
    else
    {
    AGUIMisc.ShowToast("Null");
    }
    }
    }
    This is complete code about asset bundle
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,221
    Check www error flags, also note, that the bundle have to be built for Android to be loadable there (you have to build separate bundles per platform).