• 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 /
This question was closed Apr 11, 2014 at 04:29 AM by getyour411 for the following reason:

Duplicate Question

avatar image
0
Question by FoxxCommand · Apr 10, 2014 at 09:36 AM · loading file

How do you save variables to a file to be read later?

So I'm wondering how to save variables like score or a custom level to a file, I've read up on JavaScripts 'writing to a file' but that just seems like a terrible idea since it all goes to one big file and you have to manually separate it, I've also read up on PlayerPrefs but I want something I can use to save different information to different files instead of one big PlayerPref file, I've heard you can use Xml files but I can't any information about doing so

Comment
Add comment · Show 4
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 GenuiTix · Apr 10, 2014 at 02:24 PM 1
Share

I am using X$$anonymous$$L writing/reading with C# but guessing on your comments for answers other made it will be too complicated as well for you.

Anyway either you will use some free/paid plugin for Unity which will made that easy as hell or you will have to learn how to work with files.

I recommend second option. Eventually you will end with situation where understanding I/O with files will be blocker for your development.

avatar image getyour411 · Apr 11, 2014 at 04:33 AM 0
Share

This question has many answers, some suggested here others available via UA/Google where there are many examples, tuts, vids and code examples; "I want to use X$$anonymous$$L", for example, is not a specific technical question, please review any number of resources available and if you have a specific question, ask.

avatar image FoxxCommand · Apr 11, 2014 at 02:06 PM 0
Share

@GenuiTix It's not complicated as in I don't understand it, it's complicated as in it'd be a hassle to do, as for working with files I already know how to do that, it's just from my experience if you do a basic write to a text file it just adds on to the end and there's no structure, which is why I was looking for how to get into Xml or if there was an alternative

@getyour411 I've tried Google and all the examples and tutorials were focused towards web-based applications of JavaScript and since this is Unity I was looking for something more focused towards that or every something else if it's out there

avatar image GenuiTix · Apr 11, 2014 at 08:20 PM 0
Share

@FoxxCommand then you just need to make a custom parser once and you can reuse it later. I guess it worth it.

2 Replies

  • Sort: 
avatar image
0

Answer by doska · Apr 10, 2014 at 10:03 AM

JSON is much simplier and convinient for this task. I use LitJSON.

Comment
Add comment · Show 3 · 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 FoxxCommand · Apr 10, 2014 at 10:05 AM 0
Share

I was hoping for something more JavaScript-based

avatar image doska · Apr 11, 2014 at 04:19 AM 0
Share

$$anonymous$$aybe this will help.

avatar image FoxxCommand · Apr 11, 2014 at 01:54 PM 0
Share

This could be of help

avatar image
0

Answer by flamy · Apr 10, 2014 at 10:08 AM

http://wiki.unity3d.com/index.php/SQLite

check Sqlite, you can have everything saved to a local database, it is secured compared to a file. it has Javascript support too!

And you can manage it easily.

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 FoxxCommand · Apr 10, 2014 at 10:42 AM 0
Share

Reading over this is looks like it saves everything in one file, where as I'm looking for something that lets me save in any/multiple files, which is why I'm not using PlayerPrefs

avatar image flamy · Apr 10, 2014 at 10:51 AM 0
Share

create a class which holds all the info that is needed to be saved. Serialize it and save it to a file in binary format and you can read it back to create the object!

check for serailization topics to know more.

avatar image FoxxCommand · Apr 10, 2014 at 01:32 PM 0
Share

Yeah that's going to be a little too over-complicated for what I want to do..

avatar image flamy · Apr 11, 2014 at 07:20 AM 0
Share

all those would be in less than a 20 line code!

avatar image FoxxCommand · Apr 11, 2014 at 01:59 PM 0
Share

It's not the length it's more how I'd have to implement it, since I have custom levels, a level editor and actually player data to save, that the way I'd end up implementing it would be a hassle especially when I'm sure there's other ways of doing it

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

26 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

Related Questions

Any ways to optimize an audio clip in code ? 0 Answers

How do you load characters in your Asset folder into an array, and select particular or random characters to add into a scene? 0 Answers

How to load and save data within webGL build?,Persistent load save data on webgl 1 Answer

Run-time loaded Normal Map Lighting problem 1 Answer

Is there a way to load different drives on a Mac? 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