Search Unity

Cannot load OBB level before the phone is restarted

Discussion in 'Android' started by TOES, Sep 9, 2017.

  1. TOES

    TOES

    Joined:
    Jun 23, 2017
    Posts:
    134
    As our game is more than 100MB we had to split it into APK and OBB when putting it on the Google Play store.

    It works on some phones, but when testing on Galaxy S8 Plus the game is stuck on loading a scene from the OBB. However, if we restart the device, loading works properly and the game starts.

    I read some tips that this can be caused by a lack of permissions to read from an external SD card, but the phone does not have any memory cards in it. So, both APK and OBB is in the internal disk.

    This is the code loading the level:

    Code (CSharp):
    1.     public IEnumerator LoadScene(int sceneIndex)
    2.     {
    3.         AsyncOperation async = SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive);
    4.         while(!async.isDone)
    5.         {
    6.             yield return null;
    7.         }
    8.    
    9.         Destroy(gameObject);
    10.     }
    11.  
    I have confirmed the OBB exists when the game fails to load. Could it be that the OBB file is reserved for another process, and cannot be read before the device is restarted?
     
    IgorAherne likes this.
  2. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393