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 scowthered · Apr 15, 2016 at 02:54 AM · androidsavexml

Writing to an xml file doesn't work on android

This question as been asked by a bunch of people but none seem to work for me. The first issue usually addressed is if the file in resources. Yes my file is in the resources folder and I can successfully call it using Resources.Load(path). The problem is at the end I want write to the same file I loaded but when ever I push the app to my android phone it does not save to the file, unlike when I test it in unity. The file I'm using is an xml and I have everything in place to work it just won't save. I am unsure whether it is just using the wrong path or if I need to unzip the .apk in order to write to the file.

I would also like to note I've tried using a file that is just inside the memory of the phone but that still did not work. Second note I've tried to find a definitive answer on whether I need to unzip the .apk but all the forums I've come across, including a couple wiki pages, don't mention it.

void OnApplicationQuit() { AreaContainer Areas = new AreaContainer();

     Area area0 = new Area();
     area0.name = "Matter";
     area0.character1 = 'R';
     area0.amount1 = ScriptBox.GetComponent<Points>().getPoints();

     Area area1 = new Area();
     area1.name = "1";
     area1.point = Area1Cubes[0].GetComponent<Button>().getPoint();
     area1.maxHit = Area1Cubes[0].GetComponent<Button>().getHit();
     area1.button1 = Area1Buttons[0].GetComponent<Buying>().getCompleted();
     area1.button2 = Area1Buttons[1].GetComponent<Buying>().getCompleted();

     Areas.areas.Add(area0);
     Areas.areas.Add(area1);
     var serializer = new XmlSerializer(typeof(AreaContainer));
     File.SetAttributes(Application.persistentDataPath+ "/Resources/Areas.xml", FileAttributes.Normal);
     var stream = new FileStream(Application.persistentDataPath+ "/Resources/Areas.xml", FileMode.Create);
     serializer.Serialize(stream, Areas);
     stream.Close();
 }
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by RodrigoGomes · Jun 14, 2016 at 05:15 PM

Have you fixed this?? I am hacing the same issue :(

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
avatar image
0

Answer by hellojbb1234 · Mar 31, 2017 at 01:24 AM

Same issue but with JSON @scowthered

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

76 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

Related Questions

Cant save file into Android internal memory 1 Answer

Cannot Download files to Android device (v5.3.5f1) 1 Answer

Android Game Save and Load doesn't work 0 Answers

Save Data Android C# 0 Answers

XML Loading works in PC... but not in Android 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