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 leopripos · Apr 16, 2015 at 02:37 AM · mobiledatabasedatastorage

Data Storage

Hello All, I wanna ask, How to save data for my game which is not deleted when it's uninstalled?

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

5 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Kos-Dvornik · Feb 18, 2016 at 11:32 AM

You can use this tutorial for creating custom save file or saving into player prefs. Here you will find sources compitable with XBox One as well. http://kostiantyn-dvornik.blogspot.com/2016/02/skyship-aurora-store-data-tutorial.html

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
avatar image
0

Answer by Cherno · Apr 16, 2015 at 06:34 AM

To learn how to serialize data and write it to a file, search for BinaryFormatter. It's rather simple, don't worry.

Link

Comment
Add comment · Show 4 · 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 leopripos · Apr 20, 2015 at 09:58 AM 0
Share

I had used BinaryFormatter, it's saved in Application.persistentDataPath. It still deleted when it uninstalled.

avatar image Cherno · Apr 20, 2015 at 11:03 AM 0
Share

Well, why do you save to Application.persistentDataPath then? :) Just give it any other directory on your hard disk :)

The Application.persistentDataPath is just a string.

avatar image leopripos · Apr 20, 2015 at 03:37 PM 0
Share

Which location should be used? is there some variable Application.persistentDataPath to hold it? This is for mobile development (Android, IOS, Windows Phone)

avatar image Cherno · Apr 20, 2015 at 07:41 PM 0
Share

I have no expeirence with saving data on $$anonymous$$obile ports, I don't even know if System.IO is available for that kind of build (it isn't for Web player, for example).

avatar image
0

Answer by KdRWaylander · Apr 16, 2015 at 06:50 AM

Hi,

http://docs.unity3d.com/ScriptReference/PlayerPrefs.html

or http://docs.unity3d.com/ScriptReference/Windows.File.html

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 Cherno · Apr 16, 2015 at 06:53 AM 0
Share

PlayerPrefs store to the registry, are they kept when the application is uninstalled?

avatar image KdRWaylander · Apr 17, 2015 at 05:56 AM 0
Share

That's a good question, i never went that far with playerprefs :o

EDIT: but if you mean when you quit and come back on the game, yes it does keep the values

avatar image leopripos · Apr 20, 2015 at 09:59 AM 0
Share

I had also used pleyerfreb, but it still deleted when uninstaled

avatar image
0

Answer by Sarthak123 · Apr 20, 2015 at 11:37 AM

If you are saying about your game save files, then i would prefer it to save on an drive other than C:\ such as D:\

if you are using unity's default save file loc. then drop it and use your custom according to your need. I don't work much with save files and serialization and all so i can't tell much, but as a simple example -

 import System;
 import System.IO;
 
 function name()
 {
 System.IO.File.WriteAllText("D:\Saves\MyGame\savfile.extension", "Data");
 }

This might do the trick.

Comment
Add comment · Show 4 · 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 leopripos · Apr 20, 2015 at 03:30 PM 0
Share

Thanks, it's a good idea. Define the directory directly But how can i define the directory path? Especialy for mobile (android, ios, and windows phone)?

avatar image Sarthak123 · Apr 20, 2015 at 03:45 PM 0
Share

For Pc, the above method works... i dont have any exp. with mobiles, so i cant exactly tell, but, for mobiles, i think there are no drives in mobile, andorid, IOS, windows. But, ins$$anonymous$$d of saving into internal memory, maybe you can try saving it in SD Card. I am not sure if it's possible or not. Here this might help.. http://answers.unity3d.com/questions/162211/how-to-saveload-game-on-mobileandroid.html

avatar image leopripos · Apr 20, 2015 at 03:49 PM 0
Share

I had also used pleyerfreb, but it still deleted when uninstaled

avatar image Sarthak123 · Apr 21, 2015 at 06:09 AM 0
Share

hmm... it's expected, as playerprefs saves to the default location i think, which in case in in the internal memory of mobile, so unistalling will delete the data, but in this case, i think there are 2 ways -

  1. As i already suggested, you can store data on SD Card, but every mobile does not support SD Card, so there's a chance your game will not be playable on every device.

  2. I have never worked with android game development, so i can't tell but if you working on android platform, then i have seen that game store there data on Google Play account. But i am not sure if the similar feauture is available for Windows and IOS devices.

avatar image
0

Answer by screenname_taken · Apr 20, 2015 at 07:59 PM

If it's for mobile, you may want to check into uploading stuff to Play. For example Metal Slug Defense on android is storing saved game data to Play/your account and you can retrieve it on a different device to keep on playing from where you left off.

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

22 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

Related Questions

Alternative to storing data in DB's 2 Answers

Persistent Data Storage For Mobile Platform 1 Answer

Database entegration or data storage 0 Answers

What is the most appropriate way to store and search a large csv on a mobile device? 0 Answers

Workflow Question with Unity and online Database 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