AssetBundle Loader fromserver

Hi all!

This is my very first post in this forum. I am a beginner level programmer so i think i need so help from someone I have been trying to merge code for loading an AssetBundle from server with a AsyncOperation loader but after scratching my head for a long time this is the best i came up with but for some reason the loader takes ages to come up and load the scene… any ideas or improvements to my code?

using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using System.Collections;

public class AssetBundleLoader : MonoBehaviour
{
    public GameObject loaderCounter;
    public GameObject internetChecker;
    public Slider slider;
    public Text percentagem;
    public string cenaID;

    public void Iniciar()
    {
        StartCoroutine (EnviarRequest ());
    }

    IEnumerator EnviarRequest()
    {
        using (UnityWebRequest request = UnityWebRequest.GetAssetBundle ("http://www.dimensao-digital.com/Unity/PublicidadeDigital/Android/CartazCinema/" + cenaID))
        {
            yield return request.SendWebRequest ();

            if (request.isNetworkError || request.isHttpError )
            {
                internetChecker.gameObject.SetActive (true);
                Debug.Log (request.error);
            }
            else
            {
                Debug.Log ("aqui?");
                loaderCounter.gameObject.SetActive (true);
                AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request);
                StartCoroutine (CenaLoader());
            }
        }
    }

    IEnumerator CenaLoader()
    {
        AsyncOperation operacao = SceneManager.LoadSceneAsync (cenaID);
        while (!operacao.isDone)
        {
            float progress = Mathf.Clamp01 (operacao.progress / .9f);
            slider.value = progress;
            percentagem.text = progress * 100 + "%";
            Debug.Log (percentagem.text);
            yield return null;
        }
    }
}

You’re apparently doing everything right, read :

If you have a big file that may be the cause, slow internet or server maybe.

Try to use the caching so next downloads are faster :

I understand all that but what is doing my head in is the fact that the loader does not show immediately, only shows just before the scene loads and for a couple of secs, until then the app is downloading the scene but not showing the loader which defeats the all purpose of having one…

Call
loaderCounter.gameObject.SetActive (true);
before
using (UnityWebRequest request = UnityWebRequest.GetAssetBundle (“http://www.dimensao-digital.com/Unity/PublicidadeDigital/Android/CartazCinema/” + cenaID))
and you’ll see it before.

What happens is that code execution “stays” on the
yield return request.SendWebRequest ();
until it finishes either successfully or on error.