Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by FatWednesday · Apr 14, 2015 at 10:29 AM · levelsettingsgoogleobb

Loading an OBB from a non-google source.

On a project I'm working on at the moment we've been told to host the obb the unity generates from a split build on our own servers instead of supplying it via google as you normally would.

To this end, we're trying to write a downloader that will download the obb, save it in the same place as it would normally save (normally we use the asset https://github.com/Over17/UnityOBBDownloader that I think most people end up using for this download).

Currently the obb downloads just fine from our server and saves to disk apparently without issue. However the second I try to load a scene from the obb, we see the error.

"Level "main" (1) couldn't be loaded because it has not been added to the build settings."

Now i'm confused as it says 1 instead of the normal -1 for this error. But primarily here my issue is why is this happening? I'm certain that we the apk and the obb are from the same build so its not that. Is there something else special that we should be doing when downloading the obb from our own servers?

Thanks for any ideas on this one.

EDIT:

Ok it seems that the obb will load scenes, but only when the app has restarted. It seems that unity only mounts the obb file on start, and (based on the way the normal "from-google" downloader works) on resume as well.

Currently my thinking is to create a blank android activity that i can simply activate, and complete immediately to trigger this resume behaviour but that sounds ugly as all hell. Wondering if anyone is aware of a way to force unity to try and remount the obb without needing to do a suspend/resume or restart?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HarshadK · Apr 14, 2015 at 10:41 AM 0
Share

Are you using the proper file name for your .obb file as per the File Name Format for OBB File?

avatar image FatWednesday · Apr 14, 2015 at 10:55 AM 0
Share

yes, as the post states, the file path and name for the obb file on the device is calculated in exactly the same way as it is for the normal obb downloader. I'm about to update the post with some additional information.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SummitJain · Apr 15, 2016 at 07:41 AM

@FatWednesday: Hello ,I have managed to sort it till exactly where you got stucked, my obb downloads 100 % and then it crashes..

I am sharing that part of the code below:

           if (www.error != null)
         {
             log ("wwww error " + www.error);
             percentageValue.value = 0;
         }
         else
         {
             Debug.Log("obb download" + www.data);

             Debug.Log("obb downloaded ? " + www.isDone);

             Debug.Log("obb download size " + www.bytesDownloaded);

             System.IO.Directory.CreateDirectory(GooglePlayDownloader.GetExpansionFilePath());
             Debug.Log("About to create directory");

             string futureFile = GooglePlayDownloader.GetMainOBBPath_ifNoExist(expPath);
             Debug.Log("About to create file " + futureFile);

             var bytes = www.bytes;
             AssetBundle bundle = www.assetBundle;
             Debug.Log("obb  size " + www.bytes);

             if (bytes != null)
             {
                 System.IO.File.WriteAllBytes(Application.dataPath + futureFile, bytes);
                 Debug.Log("bytes file created" + futureFile);
             }
             checkPath ();
         }

         yield return new WaitForSeconds(0.1f);

         if (www.error != null)
         {
             log ("wwww error " + www.error);
             percentageValue.value = 0;
             GameLoader.gameloaderInstance.DownloadingMsgLabel.text = "Please connect to the Internet and try again.";
             GameLoader.gameloaderInstance.ErrorIconSprite.SetActive(true);
             GameLoader.gameloaderInstance.WifiIconSprite.SetActive(false);
             GameLoader.gameloaderInstance.DownloadingMsgLabel.color = ErrormsgLabelColor;
         }
         else 
         {                
             PlayerPrefs.SetInt ("OBB", 1);
             GameLoader.gameloaderInstance.SceenLoadingSprite.SetActive (true);
             Debug.Log ("Calloing the Game Scene");
             Application.LoadLevelAsync(1);
         }

 void OnApplicationPause()
 {
     Debug.Log ("ON Paused Called");
 }

 private IEnumerator checkPath()
 {
     while (true) 
     {
         Debug.Log ("Application.dataPath" + Application.dataPath);
         yield return new WaitForSeconds (0.2f);
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Google Play - Downloaded OBB Level could not be loaded. 1 Answer

OBB downloader missing from asset store? 0 Answers

How to save a scene that you randomly generated as a new level in your build settings? 1 Answer

Is there any way to increase FPS without changing GVR default settings? 0 Answers

How to save a scene that you randomly generated as a new level in your build settings? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges