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
0
Question by Uzquiano · May 05, 2011 at 05:24 PM · buildloadxmllibrary

Problem loading XML files after build using .NET libraries

Hi,

I am reading some text from an external XML. Everything works fine in the editor, but when 'I build & run' is not able to reach the files.

Here are the messages I got in the player log related to the problems: IsolatedStorageException: Could not find a part of the path "/Users/Alvaro/Desktop/Dropbox/proyectos unity/alfa06/demo.app/Cofiles/victim.xml"

The way I code this is like this:

var writer:XmlWriter = XmlWriter.Create(Application.dataPath.Substring(0, Application.dataPath.Length - 6)+file,settings);

var reader : StreamReader = File.OpenText(Application.dataPath.Substring(0, Application.dataPath.Length - 6)+file);

Please I need some help... I am getting a bit nervous if I can't solve this :S

And I got to read this thread:

KennyW: I can read an XML file from my data folder without problem. But my question here is how will I be able to read an XML file from inside my Unity3D resources (i.e. in the "project" tab or project "Hierarchy" instead of a file path?

dreamora: you can't

if you drop it into the project it will cease to be an xml (it will no longer exist as file in the build but will be part of the sharedassets.dll file), it will become a text asset where you can get the string from but only that.

Thnks in advance

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
1
Best Answer

Answer by yoyo · May 05, 2011 at 05:47 PM

Application.dataPath only ends with "Assets" (6 characters) when you run in the Editor. You shouldn't strip anything from the dataPath, just use it directly, and move your Xml files under your Assets folder.

You probably want to put the Xml files into your Resources folder to make sure they get included in the build.

Comment
Add comment · Show 5 · 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 Uzquiano · May 05, 2011 at 05:58 PM 0
Share

Thanks yoyo. Then how is that? If I don't put my X$$anonymous$$L in the Reources folder in the build will not be included? And how is possible that in the Editor works and then in the Build don't! How can I save the player progress?... Sorry yoyo, but I am a bit disappointed :(

avatar image Eric5h5 · May 05, 2011 at 06:09 PM 0
Share

@Uzquiano: did you read the page yoyo linked to? The docs already answer these questions.

avatar image Uzquiano · May 05, 2011 at 06:57 PM 0
Share

@Eric,yes I read. Even I read before asking this question... I will have to think in a solution. $$anonymous$$aybe I was too much time getting nervous now... Now I get the point of the Resources floder, becuase it is a direct link that your build always knows... Thanks Eric

avatar image yoyo · May 05, 2011 at 08:11 PM 0
Share

Any files in your Resources folder at the time you make a build will be included in that build. This is useful for assets which you will load dynamically but which are not referenced from your scene. $$anonymous$$ore information here -- http://unity3d.com/support/documentation/ScriptReference/Resources.html

avatar image Uzquiano · May 07, 2011 at 11:53 AM 0
Share

Thanks yoyo, all this info I read sometime ago, but I got a wrong picture. Thanks agaim

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

No one has followed this question yet.

Related Questions

Distribute terrain in zones 3 Answers

How Load XML File in java? 2 Answers

Missing additional configuration xml files after build 0 Answers

Save/Load system is saving but not loading. 1 Answer

Accessing Music Library & modifying playback 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