- Home /
Android Apk + Obb Splitting | Scene is not loading
Hi there,
as it seems I have a problem with splitting my application to .apk and .obb files. I have followed this tutorial and all went fine so far... I can create the spitted files and I can successfully download the .obb in my first scene.
But after the download I can’t load the next scene (which is inside the .obb as I assume). When it comes to loading the next scene I get the following error message:
Level '02_menues' (1) couldn't be loaded because it has not been added to the build settings.
I saw that I am not the only one expiring this problem, but I didn’t found any working solution.
So far I have tried things like:
using c# code only
putting all scenes in a "Resource" folder
removed all scenes from the build settings and added them again
rebuild and reuploaded the apk/obb to google several times
... but none of these things worked.... Crazy enough: if I push the app to the phone via Unity (build and run) it is working...but not if downloaded from Google. I don’t get what I’m doing wrong.
The code I use:
using UnityEngine; using System.Collections;
public class DownloadObbExample : MonoBehaviour { private string expPath; private bool downloadStarted;
void Start() { expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { //Error System.Console.WriteLine("\nOBB DOWNLOAD: External Path not found\n"); return; } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); System.Console.WriteLine("\nOBB DOWNLOAD: External Path: " + expPath +"\n"); System.Console.WriteLine("\nOBB DOWNLOAD: Main Path: " + mainPath +"\n"); System.Console.WriteLine("\nOBB DOWNLOAD: Patch Path: " + mainPath +"\n"); if (mainPath == null) { System.Console.WriteLine("\nOBB DOWNLOAD: Main was null and OBB will be fetched now\n"); GooglePlayDownloader.FetchOBB(); System.Console.WriteLine("\nOBB DOWNLOAD: OBB has been fetched\n"); StartCoroutine(loadLevel()); } else Application.LoadLevel("02_menues"); } } protected IEnumerator loadLevel() { string mainPath; do { System.Console.WriteLine("\nOBB DOWNLOAD: Trying to fetch main path\n"); yield return new WaitForSeconds(0.5f); mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); System.Console.WriteLine("\nOBB DOWNLOAD: Main path = "+ mainPath + "\n"); } while( mainPath == null); if(downloadStarted == false ) { System.Console.WriteLine("\nOBB DOWNLOAD: Load OBB from mainPath: "+ mainPath +"\n"); downloadStarted = true; string uri = "file://" + mainPath; WWW www = WWW.LoadFromCacheOrDownload(uri , 0); // Wait for download to complete yield return www; System.Console.WriteLine("\nOBB DOWNLOAD: OBB loaded. Procede to next level...\n"); Application.LoadLevel("02_menues"); } }
Having same problem but $$anonymous$$e is sort of the same but different. The package downloads and installs and fetches the oBB but it still gets same message. I have spend ages on this now. I don't get why i cannot just upload a 100meg apk ins$$anonymous$$d.
The obb and apk have to be from the same build (otherwise you will get the "scene not found" error. Furthermore it can take even longer than 3 hours to update the obb on the play store... so just try to wait a lil longer and then test it again. Hope this will work for you too. Unfortunately you won’t get around application splitting :(
I'm still not even able to get my app to download the obb from google play... followed the same tutorial.
It says download complete 0.00kb/0.00kb and then loops back to the main scene with the fetch obb button, without having downloaded anything. Then, if I click fetch obb again it blinks to a black screen and back again. No idea what could be wrong..
Answer by Pixipulp · Jul 18, 2013 at 08:22 PM
Well it seems that my problem has been solved by waiting for Google to update the .obb + .apk file. If anyone of you experience the same problems that just rebuild your apk and obb files and commit them to Google. You should then wait for about 1-2 hours and test your application download again.
As far as I can say, the first obb file you commit is available instantly, but if you update the apk and obb files it will take a while till they are available. In this period of time you will receive the wrong obb file and get the error described above (the apk you manually push to the device doesn’t match with the downloaded .obb).
Cheers!
Answer by Meltdown · Sep 28, 2015 at 03:52 AM
Try either of these two things...
In Player Settings, change the Install location to Force Internal and Write access to Internal only
To get it working with external access (i.e file read and write), I would suggest try adding the android.permission.WRITE_EXTERNAL_STORAGE permission to your Android manifest. (Although I haven't confirmed if this works). But my guess is if you don't have this permission, and because the files being accessed were in the OBB in External storage (default player setting), they weren't found.
Answer by hollym16 · Sep 15, 2014 at 01:42 PM
I've got the exact same problem that Straafe describes. Mine can't be to do with waiting for Google to propagate it as I left it for a week and it quickly shows the download screen saying Download Finished then loops back to the first screen. Anyone been able to get around this?
EDIT: I think I found the problem with this; in Player Settings, I hadn't changed the Write Access to 'External (SDCard)'. Silly mistake, I know, but it makes a huge difference!