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 Javy · Jun 15, 2013 at 09:37 PM · textasynccrossplatformasynchronousio

How can I asynchronously load and save text files?

My game has several text files that will be included with the app when shipped.

When a player creates a new game, the text files are copied so they can be loaded, edited, then re-saved at runtime.

The load & save process needs to be:

  1. asynchronous

  2. cross-platform, especially for mobile (web player not needed)

  3. available without Unity Pro

The only thing I've found that seems to work is WWW but I'm not sure if there are cross-platform problems or if there is a better alternative.

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 Fattie · Jun 16, 2013 at 06:27 AM 0
Share

what do you mean "the only thing that works is WWW" ?

that's just what it is for, heh !

Note that, other than audio, Unity unfortunately DOES NOT stream large files well.

http://answers.unity3d.com/questions/433609/hiccups-when-loading-images-from-resources-folder.html

Other than the fact you can't get rid of items from memory, it's the only huge "$$anonymous$$or problem" in Unity at the moment.

avatar image Javy · Jun 16, 2013 at 02:26 PM 0
Share

Thanks. Good thing I was only making a test demo. It would have been sad to write half the app then encounter the strea$$anonymous$$g problem.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by kilian277 · Jun 15, 2013 at 09:43 PM

You can use the .NET assemblies for that like ,

Streamreader , reads a file in a stream: http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx

StreamWriter , writes to a file in a stream: http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx

If you want it crossplatform keep the file as text so there are no binary problems whilst porting.

Comment
Add comment · Show 4 · 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 Javy · Jun 15, 2013 at 09:47 PM 0
Share

I thought .NET was only for PC distribution. This works on all mobile (iOS, Android, BlackBerry, Win$$anonymous$$o) and consoles?

avatar image Fattie · Jun 16, 2013 at 06:26 AM 0
Share

Sure, anywhere

avatar image Javy · Jul 15, 2013 at 02:00 PM 0
Share

await isn't available for Unity, so this can't be used async

avatar image Getsumi3 · Oct 17, 2019 at 04:11 PM 1
Share

I know this is a 7 years old answer but it solved my problem.

BTW with a little magic you can use await/async/thread in Unity

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

18 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

Related Questions

Unexpected symbol CS1525 2 Answers

AsyncOperation activating immediately even with async.allowSceneActivation = false; 0 Answers

Is it possible to create a Sprite at runtime async? 0 Answers

Creating a fade out and in transition for loading. Functions not executing in order. 1 Answer

why this code is making unity unresposnive? 3 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