Search Unity

Loading level through assest bundle problem

Discussion in 'Web' started by witcher101, Oct 10, 2019.

  1. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    I am trying to load a level through assest bundle in webgl.
    I am running in to some problem. Terrain texture is not loaded. some materials appear pink. Post processing is not loaded. Anyway to fix this problem. Heres my code
    Code (CSharp):
    1.  IEnumerator Start()
    2.     {
    3.         string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "scenetest");
    4.         //  filePath = System.IO.Path.Combine(filePath, "scenetest");
    5.         Debug.Log(filePath);
    6.        
    7.        
    8.         using (UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle(filePath))
    9.         {
    10.             yield return uwr.SendWebRequest();
    11.  
    12.             if (uwr.isNetworkError || uwr.isHttpError)
    13.             {
    14.                 Debug.Log(uwr.error);
    15.             }
    16.             else
    17.             {
    18.                 // Get downloaded asset bundle
    19.                 AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(uwr);
    20.             }
    21.         }