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 morius · May 03, 2013 at 06:30 AM · androidplayerprefssaveloading

Loading a save/playerprefs from a different game?

If I wanted to make 2 games which interact with each other and can load each other's saves, or for example, a sequel of a game that can load the saved file/playerprefs from the first game in the series, what would be the best way for doing this?

I'd be looking at Android as the platform (not sure if it matters, but I thought it'd be best to mention it).

Also, I'd rather not use an xml file, since an xml file can very easily be read and edited.

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 Fattie · May 03, 2013 at 07:06 AM 0
Share

"there's an asset for that" now

http://answers.unity3d.com/questions/156531/is-playerprefs-secure.html

As I say there in the long comment, "Annoyingly (amazingly) there is no common library or code kicking around to do this."


PlayerPrefs is 100% not-secure.

It cannot be used for any real-world projects.

"Pref hackerz" are ubiquitous. For any popular iPad game, just google for videos showing you how to trivially adjust your score, etc. A preference file is nothing more than "a text file" .... it is completely trivial to "hack" it.

So you have to encrypt your preferences.

Annoyingly (amazingly) there is no common library or code kicking around to do this.

Happily, I've just noticed a package in the asset store where someone bothered to do this and make it a package in the Asset Store ....

http://forum.unity3d.com/threads/157606-Secured-PlayerPrefs-Release

Otherwise you will have to write your own or wait until someone smart puts up an open source one, or other Asset Store products.

It's a really strange issue because un-encrypted preferences are a non-starter. All real money-making games published with Unity will need encrypted prefs.

So it's weird that there isn't dozens of paid solutions for this, and open source packages everywhere, etc etc!!

The young man appeared to also incorporate Eric5h5's essential "ArrayPrefs2" in to his package (note Baroni's comment on that forum page)


you have to encrypt player prefs, and indeed encrypt any supporting incidental text files (say, level descriptions, whatever). It's really amazing this is not the "most common thing in the asset store" or that Unity don't just do it.

avatar image morius · May 03, 2013 at 07:15 AM 1
Share

Ok, let's say I find a way to encrypt the playerprefs. $$anonymous$$y question, though, remains: how can I make it so "game 2" loads the playerprefs from "game 1"?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by whydoidoit · May 03, 2013 at 06:55 AM

Have you looked at PlayerPrefs????? That can easily be edited. How about a binary file (see this Unity Gems article). You could also encrypt it by a real method like those available from http://msdn.microsoft.com/en-us/library/0ss79b2x(v=vs.85).aspx or just Xor each byte with a value to put off casual hackers.

Comment
Add comment · Show 10 · 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 morius · May 03, 2013 at 07:09 AM 0
Share

Thank you for the link. So, what do you think is the best way to do it? To make the first game save a binary file and the second game just load it?

I was thinking about playerprefs since they are always saved in a specific location, and I would want the second game to load them automatically (without asking for the player to find the save file of the first game). Any suggestions on that?

But anyway, even if I end up using the binary file... For curiosity's sake, is it possible to load a different game's playerprefs?

avatar image Fattie · May 03, 2013 at 07:23 AM 0
Share

the simple answer is you can't -- you do it via the cloud and user accounts

surely everyone knows this now? it's not 1960 eh ?

obviously iPhones completely lock up individual apps and they can't communicate. it's a basic of computing for five computing years (that's 18,000 dog years)

in iOS you can share the first-two-parts-or-something of the app id btu nobody does that or knows anything about it, it'll never happen

you're right sorry I misunderstood your question at first

I just assumed you meant from a NEW RELEASE, NEW VERSION of the same game, sorry

you can't share anything between iPhone apps, no

so if you want to do this, have user accounts on your server ...

avatar image whydoidoit · May 03, 2013 at 07:25 AM 0
Share

I don't think you can really load the prefs from another game - there appears to be no function to open prefs.

Yes so I'd save a binary file either locally or on a server and then open it - not sure what your file restrictions are on Droid - but read should be possible.

I'm presu$$anonymous$$g your app is installed in a well known location so you should be able to find it without browsing. The best option might be a server though, just upload the data to some cloud server and pull it back down. Then you could do it based on the $$anonymous$$AC address of the phone (but of course you would require a data connection).

avatar image whydoidoit · May 03, 2013 at 07:27 AM 0
Share

As @Fattie says, the only way on iOS would be the cloud.

avatar image Bunny83 · May 03, 2013 at 07:52 AM 0
Share

Isn't it possible to store files in a common user-place on iOS? For example for storing screenshots etc. I don't think that you can even read the PlayerPrefs of another game since they are stored in the internal storage. It's possible, but only with a rooted device (i can only speak for Android since i haven't tested much on iOS ;))

Show more comments
avatar image
0

Answer by DaveA · May 03, 2013 at 07:43 AM

Back to the question: On Windows at least I know you can access the Registry directly, so it's easy to get at anything, and that's where the PlayerPrefs are for Windows. Don't know how easy it is to get at other platforms, don't imagine it's terribly hard. Just find the file.

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

16 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

Related Questions

Saving boolean values using PlayerPrefs 1 Answer

Playerprefs not working on android 0 Answers

PlayerPrefs.GetInt won't load when awake. 0 Answers

Loading error when using PlayerPrefs.GetInt with WebPlayer 2 Answers

PlayerPrefs don't load again after Android game closes for the first time. 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