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
1
Question by Nub3h · Jun 19, 2013 at 09:30 AM · crashwwwipad

iPad crashes after many WWW images queries

Hi, I'm experiencing some problems with memory warnings on an iPad3 when downloading images from the web. I have to download a lot of images (200-300 at half of the device resolution) one after another (using a coroutine an waiting that an image has been downloaded before starting with the next) from a third party service and I store the WWW return data in an ArrayList. Unfortunately the iPad often crashes (but not always), sometimes it gets memory warnings and then crashes while other times it just crashes without any warning.

I know I'm downloading a lot of data, but I was wondering if there's a workaround or if there's a way to store those WWW images data in a better way and avoid memory warnings.

Thanks

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by whydoidoit · Jun 19, 2013 at 09:33 AM

Save them as files to your Application.persistentDataPath and do www.Dispose() after each image. Open the images when you need them.

     yield return www;
     System.IO.File.WriteAllBytes(Application.persistentDataPath + "/" + someFileName, www.bytes);
     www.Dispose();

  
Comment
Add comment · Show 6 · 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
avatar image Nub3h · Jun 19, 2013 at 03:21 PM 0
Share

Hi, thanks for the answer. I unfortunately get an error when I try to use the image:

You are trying to load data from a www stream which had the following error when downloading. Couldn't open file /Users/Robin/Library/Caches/$$anonymous$$yProject/imgNr1.jpeg

After executing:

 WWW imgData = new WWW("file://" + Application.persistentDataPath + "/imgNr"+frontImgFrame+".jpeg");
 yield return imgData;
 imgData.LoadImageIntoTexture(imgFront);
avatar image whydoidoit · Jun 19, 2013 at 03:23 PM 0
Share

You can use Texture2d's LoadImage and File.ReadAllBytes

avatar image Nub3h · Jun 19, 2013 at 03:34 PM 0
Share

sorry I had a typo in my code...now it works. It's a bit slow when I have to retrieve the images one after another fast...also I still get the memory warning and the crash :(

avatar image whydoidoit · Jun 19, 2013 at 03:53 PM 0
Share

You won't be able to keep many of those images in memory at a time - they take 2x the size of the uncompressed image (ignore the size of the jPeg). So a 1024x1024 is around 8$$anonymous$$B of ram.

avatar image whydoidoit · Jun 19, 2013 at 03:56 PM 0
Share

Use StartCoroutine(Resources.UnloadUnusedAssets()) to remove some.

Show more comments

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

15 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

Related Questions

Patch/Update ios App 0 Answers

load level problem when building to ipad 2 Answers

What in my stats makes the game crash on web or iPad 1 Answer

WWW random freezes 1 Answer

Loading multiple Assetbundles causes a Crash 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