Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Dwair77 · May 22, 2018 at 04:01 AM · iosarrayresourcesassetbundles

On Demand Resources downloads data but can't access to it.

Hi everyone!

I'm having some problems converting my project from WWW to OnDemandResources requests for loading bundles. I was using Unity 5.5.4.p5 and I've tried Unity 2018.1 without success.

I've tried the demo assetbundlemanager (https://bitbucket.org/Unity-Technologies/assetbundledemo) but didn't work either (loads resources in xcode correctly and www server works, but it won't work in ODR mode in Testflight).

I tried using a CollectResources load like the example, and it correctly loads UnityData, but GetResourcePath returns null for every file I'm trying to retrieve. The resource names doesn't feature extensions here.

I've also tried to manually load the files into XCode, setup the OnDemand tags and retrieve files from inside there, without success too. This code is from this version.

The code will download the ondemandresources tag, fills up to 100% done without errors. Then trows and error because the odr:// doesn't exist.

This is the error:

 Request result file: 01.bundle odr://01
 UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
 UnityEngine.Logger:Log(LogType, Object)
 UnityEngine.Debug:Log(Object)
 <LoadFromODR>c__Iterator1:MoveNext()
 UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
  
 (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
 
 ODR temp File: :
 UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
 UnityEngine.Logger:Log(LogType, Object)
 UnityEngine.Debug:Log(Object)
 <LoadFromODR>c__Iterator1:MoveNext()
 UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
  
 (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
 
 UnauthorizedAccessException: Access to the path "auto/" is denied.

Do you have any ideas about how to fix this?

This Debug.Log("ODR temp File: " + request.GetResourcePath(bundleResources[iFile].Replace(".bundle",""))); outputs no output file.

I can't use www anymore, and ondemandresources is my only alternative for this project, so I would like to know how to fix this issue.

Thanks everyone!

 static IEnumerator LoadFromODR(string path, string odrTag, string[] bundleResources){
         //waits for the other threads to finish
 
         while(request != null){
             yield return new WaitForSeconds(1);
         }
         //initializes request
         Debug.Log("Start ODR  for:" + odrTag);
         request = OnDemandResources.PreloadAsync(new string[] { odrTag });
 
         while (request.isDone == false)
         {
             Debug.Log("Request:" + odrTag + "-" + (request.progress * 100) + "%");
 
             yield return new WaitForFixedUpdate();
         }
 
         if (!string.IsNullOrEmpty(request.error))
         {
             Debug.LogError("ERROR LOADING BUNDLE FROM ODR: " + request.error);
             //    ODRPrompts.instance.DoDebug("ERROR LOADING BUNDLE FROM ODR: " + request.error);
             yield break;
         }
 
       
         Debug.Log("Start ODR resources request for:" + path + " - " + odrTag + " - " + string.Join(",",bundleResources));
        // ODRPrompts.instance.DoDebug("Start ODR request for:" + path + " - " + string.Join(",", odrTag));
         for (int iFile = 0; iFile < odrTag.Length; iFile++)
         {
             string fileName = bundleResources[iFile];
                
             Debug.Log("Request result file: " + bundleResources[iFile] + " odr://" + bundleResources[iFile].Replace(".bundle", ""));
              //   ODRPrompts.instance.DoDebug("Request result file: " + odrTag[iFile] + " odr://" + odrTag[iFile]);
             Debug.Log("ODR temp File: :" + request.GetResourcePath(bundleResources[iFile].Replace(".bundle","")));
 
             Directory.CreateDirectory(path);
             Debug.Log("Directory Created:" + path);
                     //copy request back to assets
                 try{
                 File.Copy("odr://" + bundleResources[iFile].Replace(".bundle", ""), Path.Combine(Application.persistentDataPath, path + fileName));
                   
                         
                             Debug.Log("Copied file WWW to persistent:" + Path.Combine(Application.persistentDataPath, path + fileName));
                             //bundle.mainAsset
                             //locks file (prevents iCloud backup)
                             Device.SetNoBackupFlag(Path.Combine(Application.persistentDataPath, path + fileName));
                            
 
                     }catch(IOException ex){
                         Debug.Log("ERROR:" + ex.Message);
                       //  ODRPrompts.instance.DoDebug("ERROR:" + ex.Message);
                         
                     }
                    
                     Debug.Log("Copied file ODR to persistent:" + Path.Combine(Application.persistentDataPath, path));
                  //   ODRPrompts.instance.DoDebug("Copied file ODR to persistent:" + Path.Combine(Application.persistentDataPath, path));
              
 
             }
             request.Dispose();
             request = null;
         
     }


Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

189 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 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 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 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 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 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 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 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 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 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

Texture Array 0 Answers

iOS - Placing Texture2Ds in Array cause Memory Leak? 0 Answers

Unity can not access StreamingAssets on IOS 1 Answer

Crash when load scene with mesh from assetbundle on iOS devices 0 Answers

Weird Issue: Textures become transparent when running from the editor in an android platform 0 Answers


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