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 Firedan1176 · Jul 04, 2014 at 03:10 AM · textstringfilereadsplit

Best way to manage stats in a text file

I'm thinking of reading user stats from a text file, line at a time. My questions:

  1. Saving data line-by-line. I can get the string, how do I just add a line?

  2. What do you say is the best (most efficient way) to save the user's stats (weapons, points) I'm thinking of this:

If my text file looks like this:

Username1;Password1;2.3.5.3.4.5.7.6.4/5863465/68

Username2;Password2;2.3.5.7.6.8.3.9.6.8.3/28450/01 etc.

The username and password are separated with String.Split(";");

It's also separated by the slashes and decimals, so they're all separate.

My idea is that every separated blank represents the weapon that they have per class (like 2 is sub-machine 2, etc). Then the /28450 is their points (except for the slash) and the other is their level. Maybe even upgrades/perks/etc should be included. What do you think? Remember it's going to be a string so it needs to be able to read it as text. You have a better and more efficient way?

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 Firedan1176 · Jul 04, 2014 at 02:00 PM 0
Share

Okay I guess none of you really answered my question; I'm just simply asking if anyone has a better method to store a string of text. I'm not asking how, I'm asking if you have a concept for a better way to read/write a series of numbers in a small format but easy to use. It's not really that hard of a question

avatar image HarshadK · Jul 04, 2014 at 02:09 PM 0
Share

If a string of data in a text file is not the only option you are considering then have you considered X$$anonymous$$L for storing your data? Saving and Loading Data: XmlSerializer

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Graham-Dunnett · Jul 04, 2014 at 12:32 PM

Use PlayerPrefs.

Comment
Add comment · Show 1 · 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 Firedan1176 · Jul 04, 2014 at 02:01 PM 0
Share

Thanks, but I know about PlayerPrefs. That's not what I want to use. I guess I should've mentioned that.

avatar image
0

Answer by kannan21 · Jul 04, 2014 at 12:35 PM

Create a class called playerstats and then save all the data in that class, then save all the classes in a list and then serialize that list. I use this method to serialize my data.

http://msdn.microsoft.com/en-us/library/4abbf6k0(v=vs.110).aspx

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

23 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

Related Questions

Write and read text files with c# 1 Answer

Read dialog text from text file in javascript 0 Answers

How do I read read from and write to a text file? 2 Answers

Problem Reading A Text File 2 Answers

Why is reading some text files with JS so darn slow?! (title changed to reflect answers) 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