• 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 givi · Jun 02, 2012 at 01:54 PM · iphoneassetbundlewwwloadingipad

WWW.LoadFromCacheOrDownload not working

I can't figure out why WWW.LoadFromCacheOrDownload is not working. Here is simple script

 using UnityEngine;
 using System.Collections;

 public class Main : MonoBehaviour {

 // Use this for initialization
 void Start () {
     loadAndCreate(null);
 }
 
 // Update is called once per frame
 void Update () {
 
 }
 
 
 public static void loadAndCreate(string _url) {
     Instantiate(WWW.LoadFromCacheOrDownload("https://www.dropbox.com/s/2ap3ixvab2lpqkn/Flame_ios.unity3d?dl=1", 1).assetBundle.mainAsset, new Vector3(0,5,0), Quaternion.identity);
 }
 }




It works absolutely fine in Editor. But when I load application on iPad everything I get is

starting www download: https://www.dropbox.com/s/2ap3ixvab2lpqkn/Flame_ios.unity3d?dl=1

And after this my main thread is halted. Here is the stack trace when paused:

alt text

I'm using Unity 3.5.2f2 with iPhone Pro license.

Screen Shot 2012-06-02 at 2.57.56 PM.png (26.2 kB)
Comment
Add comment · Show 1
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 keld-oelykke · Jun 02, 2012 at 05:12 PM 0
Share

Have you tried http ins$$anonymous$$d of https?

https usually requires you to do some callback handling regarding certificate checking.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rutter · Jun 02, 2012 at 05:17 PM

Bad idea to run blocking operations on the main thread. Looks like your WWW call won't return until the asset is fully downloaded and extracted, which will effectively freeze the game until that happens.

Instead, you may want to run the WWW call as a coroutine -- with the "yield" keyword -- or check periodically to see if it has finished. There are plenty of tutorials about this around the net, but here are some links to get you started:

  • http://unity3d.com/support/documentation/ScriptReference/WWW.html

  • http://unity3d.com/support/documentation/ScriptReference/WWW.LoadFromCacheOrDownload.html

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

WWW in iOS does not set user agent header 1 Answer

[help]How can I read the file in StreamingAssets on iPad/iPhone platform??? 0 Answers

best way to show iphone purchased assets 0 Answers

Large memory footprint increase when assigning a GUITexture from a WWW Object on iPad 1 Answer

Are apps that use AssetBundles always out-of-luck when a client's offline? 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