Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 G3R1 · Jun 20, 2017 at 07:10 AM · androidiosloadsavingdata

The best way to save and load data for mobile in unity ?

Hi,

I just wanted to know what is the best way to save data for mobile games in unity for both platforms Android and iOS. For the moment i only know PlayerPrefs class but this wasn't secure asi understood. I am finishing my first game for mobile and wanted to know how to save data like score and unlocked items, etc., in users mobile phone and Google Play Services too. Also, how can I save data online like Google Play Services for iOS platform too ?

I'd be grateful if you suggested me something because I have no idea how to achieve this for the moment. Share links and sites too if there is any tutorial for any of these methods in saving mobile game data.

Thank you, Gerald Bathorja.

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 hexagonius · Jun 20, 2017 at 07:39 AM 0
Share

There is no best way. Some games safe a few things others way more... It also depends on the type of data. Volume? Hacking wouldn't really hurt here, right?
There are several ways of writing binary data, readable (X$$anonymous$$L, JSON) and unreadable (custom).
You can always run those through some encryption algorithms too

avatar image G3R1 hexagonius · Jun 20, 2017 at 08:15 AM 0
Share

Thank's for your reply. $$anonymous$$ost of data type are integers and string. I was interested saving these data on google play services too. Does the same thing apply for iOS platform too ? Or should I use Game Data Center for iOS devices ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by fermea_t · Jun 20, 2017 at 08:48 AM

Hello,

I'm not an expert but I advice you to check about the ScriptableObject. That is easy to store data.

You can find some tutorials about it here : https://unity3d.com/fr/learn/live-training Here is an introduction to Scriptable Objects : https://unity3d.com/fr/learn/tutorials/modules/beginner/live-training-archive/scriptable-objects

However I hope for you that someone who know more about the subject will respond to you.

Have a nice day.

Timothée Fermeaux

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 G3R1 · Jun 20, 2017 at 08:58 AM 0
Share

Thank's for your suggestion. I am not sure if scriptable object is what I need but I will check it anyway.

avatar image fermea_t G3R1 · Jun 20, 2017 at 10:31 AM 0
Share

What do you need to store ? GameObjects, Attributes ?

Because for the score I think you are using an int and for the Unlocked Items a List.

Then you can create a ScriptableObject named GameInfo and put a private unsigned int m_BestScore attribute that store the best score of the player with a public method GetBestScore() to get the attribute and a public method CompareBestScore(unsigned int score) to compare the value of the current score with the best one and if the new score is better then you change the value of m_BestScore. I don't know how you will store the "Unlocked Items", but you can declare again a private List m_UnlockedItems attribute which store all the unlocked items with T is the type of one Unlocked Item that can be an enum or a GameObject, I don't know exactly ^^. Then you can add a public method IsUnlocked(T item) which returns a boolean if the item is unlocked, and you can add a public method to add an item to the list.

When you change an attribute you can Save() and then you have all your data saved.

ScriptableObjects are made to store data and it's easy and it's specifically made for Unity.

It has better performance than Json, X$$anonymous$$L ...

avatar image G3R1 fermea_t · Jun 20, 2017 at 10:50 AM 0
Share

Great thank you, what about saving player score and unlocked items to Google Play Services ? Is it the same with iOS ?

Thank's again for the info. ;)

Show more comments
Show more comments

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

145 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 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 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 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 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 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

Load Xml on Android with XmlReader 2 Answers

Issue saving data accross multiple platforms 0 Answers

Saving data files in iOS 3 Answers

PlayerPrefs for unlocking items 1 Answer

Load from Xml on Iphone and Android 2 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