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 ragnaros100 · Jul 05, 2012 at 09:51 AM · c#textsaveloadsaveload

create text file in C#.

I've been searching for quite a while on this subject. And people tend to allways write in javascript here. I kinda have an idea of how this works. (this question helped me alot, but didnt answer how to write it in C#) I basicly want the same thing as this guy... But just in C#. Scriptrefference didnt help me either.

-thanks :) Link to my next question

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

Answer by CHPedersen · Jul 05, 2012 at 10:00 AM

You'll notice that I'm the one who replied to the link you posted, and I code in C#. ;)

The method I was using is still valid,

 System.IO.File.WriteAllText("C:\blahblah_yourfilepath\yourtextfile.txt", "This is text that goes into the text file");

Is part of C#'s standard library, but you won't find this documented in the script reference, because it's not part of the Unity API, it's a standard .Net method. Look to MSDN for documentation on such. Here's the link, for your convenience:

http://msdn.microsoft.com/en-us/library/ms143375.aspx

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 ragnaros100 · Jul 05, 2012 at 10:02 AM 0
Share

omg thanks :D You're awesome

avatar image CHPedersen · Jul 05, 2012 at 10:03 AM 0
Share

You're welcome, I'm happy to help. :) (I edited the post multiple times for various typos...)

avatar image ragnaros100 · Jul 05, 2012 at 11:44 AM 0
Share

Now I just need to know... How do you read the text file you just created?... (The reason I need this, is because I need to transfer some variables from one scene to another. And i also have to save some variables like playerlevel and attached weapon and such...) I know this isnt a part of the question. But I thought you might also have the answer for this question :)

avatar image CHPedersen · Jul 06, 2012 at 08:34 AM 0
Share

$$anonymous$$ake a new question, and we can continue our discussion in that. :) (This is so that others can find the answer on how to read from files if they search on google)

avatar image CHPedersen · Jul 06, 2012 at 08:34 AM 0
Share

Oh, you did already. Never$$anonymous$$d.

avatar image
0

Answer by AlexTuduran · Aug 07, 2018 at 12:35 PM

And make sure to use "\\" instead of "\" for hard-coded paths. :)

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

,Block Levels and save progress 1 Answer

Playerprefs doesn't save anything. 2 Answers

Only able to save inside the editor problem 2 Answers

Save progress in WebGL game (C#) 1 Answer

Can't get serialization Load/Save to work!C# 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