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 catwoman · Mar 15, 2013 at 08:53 AM · build-errorassetfiles

Build settings: how to export files into the build

Hi, I'm building my game for PC platform. In my Assets folder I've put some files and folders, for example there's an xml with some setting parameters of the game.

I get the files in my scripts using the Path (for example "Assets\\Settings\\settings.xml")

The game is working great in the unity editor, but when I start the built .exe version, it shows me the error that it cannot find those files in the Assets folder.

So which is the best way in order to use some custom files that is available also in the Built version?

Thank you!! :D

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 deltamish · Mar 15, 2013 at 09:18 AM 0
Share

hi you do know that unity uses scens to build your game ie when you click build you should add scenes that you would like to use in your game go here to know what i am saying

/PublishingBuilds.html

and why are you using xml files for(by setting did you mean your game setting or other unity setting if) try putting them in standard asset folder

avatar image catwoman · Mar 15, 2013 at 09:21 AM 0
Share

Hi, thanks for your reply.

Yes i've added all the scenes in the Build Settings.

I'm using some extra xml files for some settings of my game and for example each level of the game is described by an xml file in the folder Assets/Levels...

So it's like the built version is not able to reach the Assets folder...

1 Reply

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

Answer by flamy · Mar 15, 2013 at 09:34 AM

The assets that are used in the scenes that are included in the build settings are only exported during the building process. So custom files like XML or TXT are not included normally......... Unless it is inside "Resources" Folder.

So Make a folder named Resources in side assets folder and place your xml inside that

And now loading the XML is a bit tricky,

     TextAsset temp = Resources.Load(XmlFileName) as TextAsset;            
     XmlDocument _doc = new XmlDocument();
    _doc.LoadXml(temp.text);

instead of loading from stream or other you have to use TextAsset from unity to load xml here. except the loading part the method of handling would be the same ..

Hope it helps :)

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 catwoman · Mar 17, 2013 at 04:37 PM 0
Share

hey! It's working! Thanks!!

avatar image flamy · Mar 18, 2013 at 06:40 AM 0
Share

happy tht it works :). FYI all custom files should only be handled this way, whether it is xml or txt or watever format it is.

avatar image catwoman · Mar 24, 2013 at 03:20 PM 1
Share

Since I need also to update this files, and this should work on all platform devices, the Resources folder is not good.

The final solution is to add all the content in the Strea$$anonymous$$gAssets folder, and copy all of that content into to PersistentDataPath for example during the first Scene.

Thanks.

avatar image ben06feb catwoman · Jul 27, 2016 at 11:55 AM 0
Share

@catwoman - Could you please explain how can I do that with an example. I am having a xml file with question and choices in the game, which needs to be updated. Its a standalone build for PC & OSX, have placed the file in strea$$anonymous$$g assets folder and assigned in the game directly. Found it in the build, its not updating in the game when I made changes in that file.

Regards, Ben

avatar image mechane catwoman · Dec 18, 2019 at 08:28 PM 0
Share

this comment helped me a lot

more on the Strea$$anonymous$$gAssets folder here : https://docs.unity3d.com/$$anonymous$$anual/Strea$$anonymous$$gAssets.html

avatar image Rokyyyyy · May 08, 2014 at 11:36 AM 0
Share

not understood.. it will be helpful if you give some code example of updating xml document...

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

How can I stop the variable values reverting to its default values after being built? 1 Answer

Create / preserve file in asset folder. 2 Answers

I built my project for WebGL but no files were created in the target folder. 0 Answers

Unity freezes on Packaging assest:sharedassets0.assest 2 Answers

Why i cant see anything? ANYTHING! 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