Search Unity

Application.LoadLevelAsync not working on Android if compiled from cloud.

Discussion in 'Unity Build Automation' started by Xorboo, Mar 24, 2015.

  1. Xorboo

    Xorboo

    Joined:
    Dec 6, 2014
    Posts:
    6
    Android application stucks on Application.LoadLevelAsync if the game is compiled from unity cloud (4.6.2). If i compile it from my pc it works absolutely fine.
    Code:
    Code (CSharp):
    1.     private AsyncOperation loadingOperation;
    2.     public MeshRenderer progressRenderer;
    3.     float percents = 0;
    4.  
    5.     // Called at the end of another Coroutine which shows logos
    6.     public void StartLoading()
    7.     {
    8.         StartCoroutine("StartLoad");
    9.     }
    10.  
    11.     IEnumerator StartLoad()
    12.     {
    13.         Debug.Log("LOADER: Starting loading");
    14.  
    15.         if (Application.levelCount < 2)
    16.         {
    17.             Debug.LogError("LOADER: Level Count < 2!");
    18.         }
    19.  
    20.         loadingOperation = Application.LoadLevelAsync(1);
    21.         yield return loadingOperation;
    22.     }
    23.  
    24.     void Update()
    25.     {
    26.         if (Application.isLoadingLevel)
    27.         {
    28.             percents = loadingOperation.progress;
    29.  
    30.             if (percents > 1)
    31.             {
    32.                 percents = 1;
    33.             }
    34.         }
    35.  
    36.         Vector4 vector = new Vector4(0, 0, percents, 1);
    37.         progressRenderer.material.SetVector("_Rect", vector);
    38.     }
    39.  
    Normal log:
    Log from cloud:
    Compiled on my machine, apk works well with both delevopment and production builds.
    I thought about pthread_create fail, but this warning appears in both cases. I added a check for scenes count (have only 2 scenes in the game) and it doesn't call LogError in cloud build. First scene with some logos works fine and just hangs forever after LoadLevelAsync call.
    What am i doing wrong?
     
  2. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    Can you add a log to if (Application.isLoadingLevel) to see what the loading progress is?

    I used it properly in UCB so this should not be an issue. Do you have a small reproducible project?